Class CachingDirectives
- java.lang.Object
-
- akka.http.javadsl.server.directives.CachingDirectives
-
public class CachingDirectives extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description CachingDirectives()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K> RouteAdapter
alwaysCache(Cache<K,RouteResult> cache, scala.PartialFunction<RequestContext,K> keyer, java.util.function.Supplier<Route> inner)
Wraps its inner Route with caching support using the givenCache
implementation and keyer function.static <K> RouteAdapter
cache(Cache<K,RouteResult> cache, scala.PartialFunction<RequestContext,K> keyer, java.util.function.Supplier<Route> inner)
Wraps its inner Route with caching support using the givenCache
implementation and keyer function.static RouteAdapter
cachingProhibited(java.util.function.Supplier<Route> inner)
Passes only requests to the inner route that explicitly forbid caching with aCache-Control
header with either ano-cache
ormax-age=0
setting.static <K> Cache<K,RouteResult>
routeCache(CachingSettings settings)
Creates anLfuCache
-
-
-
Method Detail
-
cache
public static <K> RouteAdapter cache(Cache<K,RouteResult> cache, scala.PartialFunction<RequestContext,K> keyer, java.util.function.Supplier<Route> inner)
Wraps its inner Route with caching support using the givenCache
implementation and keyer function.Use
JavaPartialFunction
to build thekeyer
.- Parameters:
cache
- (undocumented)keyer
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-
cachingProhibited
public static RouteAdapter cachingProhibited(java.util.function.Supplier<Route> inner)
Passes only requests to the inner route that explicitly forbid caching with aCache-Control
header with either ano-cache
ormax-age=0
setting.- Parameters:
inner
- (undocumented)- Returns:
- (undocumented)
-
alwaysCache
public static <K> RouteAdapter alwaysCache(Cache<K,RouteResult> cache, scala.PartialFunction<RequestContext,K> keyer, java.util.function.Supplier<Route> inner)
Wraps its inner Route with caching support using the givenCache
implementation and keyer function. Note that routes producing streaming responses cannot be wrapped with this directive.- Parameters:
cache
- (undocumented)keyer
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-
routeCache
public static <K> Cache<K,RouteResult> routeCache(CachingSettings settings)
Creates anLfuCache
Default settings are available via
akka.http.caching.javadsl.CachingSettings.create
.- Parameters:
settings
- (undocumented)- Returns:
- (undocumented)
-
-