use of org.apache.jackrabbit.oak.cache.CacheStats in project jackrabbit-oak by apache.
the class CacheChangesTrackerTest method createCache.
private NodeDocumentCache createCache() {
Cache<CacheValue, NodeDocument> nodeDocumentsCache = new CacheLIRS<CacheValue, NodeDocument>(10);
Cache<StringValue, NodeDocument> prevDocumentsCache = new CacheLIRS<StringValue, NodeDocument>(10);
CacheStats nodeDocumentsCacheStats = Mockito.mock(CacheStats.class);
CacheStats prevDocumentsCacheStats = Mockito.mock(CacheStats.class);
NodeDocumentLocks locks = new StripedNodeDocumentLocks();
return new NodeDocumentCache(nodeDocumentsCache, nodeDocumentsCacheStats, prevDocumentsCache, prevDocumentsCacheStats, locks);
}
use of org.apache.jackrabbit.oak.cache.CacheStats in project jackrabbit-oak by apache.
the class LuceneIndexProviderService method initializeExtractedTextCache.
private void initializeExtractedTextCache(BundleContext bundleContext, Map<String, ?> config) {
int cacheSizeInMB = PropertiesUtil.toInteger(config.get(PROP_EXTRACTED_TEXT_CACHE_SIZE), PROP_EXTRACTED_TEXT_CACHE_SIZE_DEFAULT);
int cacheExpiryInSecs = PropertiesUtil.toInteger(config.get(PROP_EXTRACTED_TEXT_CACHE_EXPIRY), PROP_EXTRACTED_TEXT_CACHE_EXPIRY_DEFAULT);
boolean alwaysUsePreExtractedCache = PropertiesUtil.toBoolean(config.get(PROP_PRE_EXTRACTED_TEXT_ALWAYS_USE), PROP_PRE_EXTRACTED_TEXT_ALWAYS_USE_DEFAULT);
extractedTextCache = new ExtractedTextCache(cacheSizeInMB * ONE_MB, cacheExpiryInSecs, alwaysUsePreExtractedCache);
if (extractedTextProvider != null) {
registerExtractedTextProvider(extractedTextProvider);
}
CacheStats stats = extractedTextCache.getCacheStats();
if (stats != null) {
oakRegs.add(registerMBean(whiteboard, CacheStatsMBean.class, stats, CacheStatsMBean.TYPE, stats.getName()));
log.info("Extracted text caching enabled with maxSize {} MB, expiry time {} secs", cacheSizeInMB, cacheExpiryInSecs);
}
}
Aggregations