Ejemplo n.º 1
0
 protected static void doRemoveFromCache(String key) {
   if (cache.containsKey(key)) {
     ConversionCacheEntry cce = cache.get(key);
     cce.remove();
     cache.remove(key);
   }
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
  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);
    }
  }