use of com.yahoo.elide.datastores.aggregation.cache.CaffeineCache in project elide by yahoo.
the class ElideAutoConfiguration method buildQueryCache.
/**
* Creates a query result cache to be used by {@link #buildDataStore}, or null if cache is to be disabled.
* @param settings Elide configuration settings.
* @return An instance of a query cache, or null.
*/
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(name = "elide.aggregation-store.enabled", havingValue = "true")
public Cache buildQueryCache(ElideConfigProperties settings) {
CaffeineCache cache = null;
int maxCacheItems = settings.getAggregationStore().getQueryCacheMaximumEntries();
if (maxCacheItems > 0) {
cache = new CaffeineCache(maxCacheItems, settings.getAggregationStore().getDefaultCacheExpirationMinutes());
if (meterRegistry != null) {
CaffeineCacheMetrics.monitor(meterRegistry, cache.getImplementation(), "elideQueryCache");
}
}
return cache;
}
Aggregations