Search in sources :

Example 6 with CacheStats

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);
}
Also used : NodeDocumentLocks(org.apache.jackrabbit.oak.plugins.document.locks.NodeDocumentLocks) StripedNodeDocumentLocks(org.apache.jackrabbit.oak.plugins.document.locks.StripedNodeDocumentLocks) StripedNodeDocumentLocks(org.apache.jackrabbit.oak.plugins.document.locks.StripedNodeDocumentLocks) CacheValue(org.apache.jackrabbit.oak.cache.CacheValue) CacheStats(org.apache.jackrabbit.oak.cache.CacheStats) NodeDocument(org.apache.jackrabbit.oak.plugins.document.NodeDocument) StringValue(org.apache.jackrabbit.oak.plugins.document.util.StringValue) CacheLIRS(org.apache.jackrabbit.oak.cache.CacheLIRS)

Example 7 with CacheStats

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);
    }
}
Also used : CacheStatsMBean(org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean) CacheStats(org.apache.jackrabbit.oak.cache.CacheStats)

Aggregations

CacheStats (org.apache.jackrabbit.oak.cache.CacheStats)7 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)4 Test (org.junit.Test)4 CacheStatsMBean (org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean)2 Supplier (com.google.common.base.Supplier)1 IOException (java.io.IOException)1 CheckpointMBean (org.apache.jackrabbit.oak.api.jmx.CheckpointMBean)1 PersistentCacheStatsMBean (org.apache.jackrabbit.oak.api.jmx.PersistentCacheStatsMBean)1 CacheLIRS (org.apache.jackrabbit.oak.cache.CacheLIRS)1 CacheValue (org.apache.jackrabbit.oak.cache.CacheValue)1 BlobGC (org.apache.jackrabbit.oak.plugins.blob.BlobGC)1 BlobGCMBean (org.apache.jackrabbit.oak.plugins.blob.BlobGCMBean)1 BlobGarbageCollector (org.apache.jackrabbit.oak.plugins.blob.BlobGarbageCollector)1 BlobStoreStats (org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats)1 NodeDocument (org.apache.jackrabbit.oak.plugins.document.NodeDocument)1 NodeDocumentLocks (org.apache.jackrabbit.oak.plugins.document.locks.NodeDocumentLocks)1 StripedNodeDocumentLocks (org.apache.jackrabbit.oak.plugins.document.locks.StripedNodeDocumentLocks)1 CacheType (org.apache.jackrabbit.oak.plugins.document.persistentCache.CacheType)1 PersistentCacheStats (org.apache.jackrabbit.oak.plugins.document.persistentCache.PersistentCacheStats)1 StringValue (org.apache.jackrabbit.oak.plugins.document.util.StringValue)1