Search in sources :

Example 1 with RouteResult

use of akka.http.javadsl.server.RouteResult in project mantis by Netflix.

the class JobClusterRoute method createCache.

private Cache<Uri, RouteResult> createCache(ActorSystem actorSystem) {
    final CachingSettings defaultCachingSettings = CachingSettings.create(actorSystem);
    final LfuCacheSettings lfuCacheSettings = defaultCachingSettings.lfuCacheSettings().withInitialCapacity(5).withMaxCapacity(50).withTimeToLive(Duration.create(1, TimeUnit.SECONDS));
    final CachingSettings cachingSettings = defaultCachingSettings.withLfuCacheSettings(lfuCacheSettings);
    // Created outside the route to potentially allow using
    // the same cache across multiple calls
    final Cache<Uri, RouteResult> jobClustersListCache = LfuCache.create(cachingSettings);
    return jobClustersListCache;
}
Also used : RouteResult(akka.http.javadsl.server.RouteResult) CachingSettings(akka.http.caching.javadsl.CachingSettings) Uri(akka.http.javadsl.model.Uri) LfuCacheSettings(akka.http.caching.javadsl.LfuCacheSettings)

Aggregations

CachingSettings (akka.http.caching.javadsl.CachingSettings)1 LfuCacheSettings (akka.http.caching.javadsl.LfuCacheSettings)1 Uri (akka.http.javadsl.model.Uri)1 RouteResult (akka.http.javadsl.server.RouteResult)1