Examples of BlockingCache


Examples of net.sf.ehcache.constructs.blocking.BlockingCache

  public static <T extends Nameable> void updateCaches(CacheManager cacheManager, T obj, Class<T> cacheClass) {
    Cache cache = DbUtils.lookupCache(cacheManager, cacheClass, true);
    if (cache != null && cache.getKeys().size() > 0) {
      log.debug("Removing " + cacheClass.getSimpleName() + " " + obj.getId() + " from " + cache.getName());
      BlockingCache c = new BlockingCache(cache);
      c.remove(DbUtils.hashCodeCacheKeyFor(obj.getId()));
    }

    cache = DbUtils.lookupCache(cacheManager, cacheClass, false);
    if (cache != null && cache.getKeys().size() > 0) {
      log.debug("Removing " + cacheClass.getSimpleName() + " " + obj.getId() + " from " + cache.getName());
      BlockingCache c = new BlockingCache(cache);
      c.remove(DbUtils.hashCodeCacheKeyFor(obj.getId()));
    }
  }
View Full Code Here

Examples of net.sf.ehcache.constructs.blocking.BlockingCache

    }
  }

  public static <T> void updateListCache(Cache cache, boolean replace, T obj, Class<T> cacheClass) {
    if (cache != null && cache.getKeys().size() > 0) {
      BlockingCache c = new BlockingCache(cache);
      Object cachekey = c.getKeys().get(0);
      List<T> e = (List<T>)c.get(cachekey).getObjectValue();
      if (e.remove(obj)) {
        if (replace) {
          e.add(obj);
        }
      }
      else {
        e.add(obj);
      }
      c.put(new Element(cachekey, e));
    }
  }
View Full Code Here

Examples of net.sf.ehcache.constructs.blocking.BlockingCache

      else {
        return new SelfPopulatingCache(cache, this.cacheEntryFactory);
      }
    }
    if (this.blocking) {
      return new BlockingCache(cache);
    }
    return cache;
  }
View Full Code Here

Examples of net.sf.ehcache.constructs.blocking.BlockingCache

      else {
        return new SelfPopulatingCache(cache, this.cacheEntryFactory);
      }
    }
    if (this.blocking) {
      return new BlockingCache(cache);
    }
    return cache;
  }
View Full Code Here

Examples of net.sf.ehcache.constructs.blocking.BlockingCache

      } else {
        return new SelfPopulatingCache(cache, this.cacheEntryFactory);
      }
    }
    if (this.blocking) {
      return new BlockingCache(cache);
    }
    return cache;
  }
View Full Code Here

Examples of net.sf.ehcache.constructs.blocking.BlockingCache

        if(!cacheManager.cacheExists(cacheName)) {
           cacheManager.addCache(cacheName);
        }

        Ehcache cache = cacheManager.getEhcache(cacheName);
        BlockingCache blockingCache = new BlockingCache(cache);
        blockingCache.setTimeoutMillis(timeout);
        return blockingCache;
    }
View Full Code Here

Examples of net.sf.ehcache.constructs.blocking.BlockingCache

     *
     * @param cache
     *            a non-null {@link Ehcache}
     */
    public void setCache(Ehcache cache) {
        BlockingCache ref;

        if (!(cache instanceof BlockingCache)) {
            ref = new BlockingCache(cache);
            cache.getCacheManager().replaceCacheWithDecoratedCache(cache, new BlockingCache(cache));
        } else {
            ref = (BlockingCache) cache;
        }

        this.cache = ref;
View Full Code Here

Examples of org.apache.ibatis.cache.decorators.BlockingCache

        cache = new SerializedCache(cache);
      }
      cache = new LoggingCache(cache);
      cache = new SynchronizedCache(cache);
      if (blocking) {
        cache = new BlockingCache(cache);
      }
      return cache;
    } catch (Exception e) {
      throw new CacheException("Error building standard cache decorators.  Cause: " + e, e);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.