protected static void doRemoveFromCache(String key) { if (cache.containsKey(key)) { ConversionCacheEntry cce = cache.get(key); cce.remove(); cache.remove(key); } }
protected static BlobHolder doGetFromCache(String key) { ConversionCacheEntry cacheEntry = cache.get(key); if (cacheEntry != null) { if (cacheHits == Long.MAX_VALUE) { cacheHits = 0; } else { cacheHits += 1; } return cacheEntry.restore(); } return null; }
protected static void doAddToCache(String key, BlobHolder result) { ConversionCacheEntry cce = new ConversionCacheEntry(result); boolean persisted = false; try { persisted = cce.persist(getCacheEntryPath(key)); } catch (IOException e) { log.error("Error while trying to persist cache entry", e); } if (persisted) { cache.put(key, cce); } }