Search in sources :

Example 1 with LfuCacheSettings

use of akka.http.caching.javadsl.LfuCacheSettings 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);
}
Also used : CachingSettings(akka.http.caching.javadsl.CachingSettings) LfuCacheSettings(akka.http.caching.javadsl.LfuCacheSettings)

Example 2 with LfuCacheSettings

use of akka.http.caching.javadsl.LfuCacheSettings 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)

Example 3 with LfuCacheSettings

use of akka.http.caching.javadsl.LfuCacheSettings 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);
}
Also used : CachingSettings(akka.http.caching.javadsl.CachingSettings) LfuCacheSettings(akka.http.caching.javadsl.LfuCacheSettings)

Aggregations

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