org.baswell.routes
Interface RoutesCache

All Known Implementing Classes:
SimpleRoutesCache

public interface RoutesCache

By default the Routes engine will sequential check each route method until a match is found. With lots of route methods, this can potentially become a performance bottle neck. If a cache implementation is provided, the Routes engine will first check the cache for a hit before running the sequential check.

See Also:
RoutesConfiguration.routesCache

Method Summary
 java.lang.Object get(HttpMethod method, RequestedMediaType requestedMediaType, RequestPath path, RequestParameters parameters)
          Retrieve the cached route instance or null on a cache miss.
 void put(java.lang.Object routeNode, HttpMethod method, RequestedMediaType requestedMediaType, RequestPath path, RequestParameters parameters)
          Called after a request has been processed by the given routeNode.
 

Method Detail

put

void put(java.lang.Object routeNode,
         HttpMethod method,
         RequestedMediaType requestedMediaType,
         RequestPath path,
         RequestParameters parameters)
Called after a request has been processed by the given routeNode. This request should be cached for later retrieval from get when the HTTP request input parameters match.

Parameters:
routeNode - The route instance to be retrieved later from get.
method - The HTTP method.
requestedMediaType - The requested media type.
path - The HTTP path.
parameters - The HTTP parameters.

get

java.lang.Object get(HttpMethod method,
                     RequestedMediaType requestedMediaType,
                     RequestPath path,
                     RequestParameters parameters)
Retrieve the cached route instance or null on a cache miss.

Parameters:
method - The HTTP method.
requestedMediaType - The requested media type.
path - The HTTP path.
parameters - The HTTP parameters.
Returns:
The cached route instance or null on a cache miss.