use of akka.http.caching.javadsl.CachingSettings in project mantis by Netflix.
the class BaseRoute method createCache.
protected Cache<Uri, RouteResult> createCache(ActorSystem actorSystem, int initialCapacity, int maxCapacity, int ttlMillis) {
final CachingSettings defaultCachingSettings = CachingSettings.create(actorSystem);
final LfuCacheSettings lfuCacheSettings = defaultCachingSettings.lfuCacheSettings().withInitialCapacity(initialCapacity).withMaxCapacity(maxCapacity).withTimeToLive(Duration.create(ttlMillis, TimeUnit.MILLISECONDS));
final CachingSettings cachingSettings = defaultCachingSettings.withLfuCacheSettings(lfuCacheSettings);
return LfuCache.create(cachingSettings);
}
use of akka.http.caching.javadsl.CachingSettings 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;
}
use of akka.http.caching.javadsl.CachingSettings in project mantis by Netflix.
the class BaseRoute method createCache.
protected Cache<Uri, RouteResult> createCache(ActorSystem actorSystem, int initialCapacity, int maxCapacity, int ttlMillis) {
final CachingSettings defaultCachingSettings = CachingSettings.create(actorSystem);
final LfuCacheSettings lfuCacheSettings = defaultCachingSettings.lfuCacheSettings().withInitialCapacity(initialCapacity).withMaxCapacity(maxCapacity).withTimeToLive(Duration.create(ttlMillis, TimeUnit.MILLISECONDS));
final CachingSettings cachingSettings = defaultCachingSettings.withLfuCacheSettings(lfuCacheSettings);
return LfuCache.create(cachingSettings);
}
Aggregations