use of com.adobe.acs.commons.httpcache.store.jcr.impl.handler.EntryNodeToCacheContentHandler in project acs-aem-commons by Adobe-Consulting-Services.
the class JCRHttpCacheStoreImpl method getIfPresent.
@Override
public CacheContent getIfPresent(final CacheKey key) {
final long currentTime = System.currentTimeMillis();
incrementRequestCount();
return withSession(new Function<Session, CacheContent>() {
@Override
public CacheContent apply(Session session) throws Exception {
final BucketNodeFactory factory = new BucketNodeFactory(session, cacheRootPath, key, bucketTreeDepth);
final Node bucketNode = factory.getBucketNode();
if (bucketNode != null) {
final Node entryNode = new BucketNodeHandler(bucketNode, dclm).getEntryIfExists(key);
final CacheContent content = new EntryNodeToCacheContentHandler(entryNode).get();
if (content != null) {
incrementTotalLookupTime(System.currentTimeMillis() - currentTime);
incrementHitCount();
return content;
}
}
incrementTotalLookupTime(System.currentTimeMillis() - currentTime);
incrementMissCount();
return null;
}
});
}
Aggregations