Package net.sf.ehcache

Examples of net.sf.ehcache.Cache$CacheStatus


        } else {
            cacheManager = EHCacheManagerHolder.getCacheManager(bus, getDefaultConfigFileURL());
        }
        CacheConfiguration cc = EHCacheManagerHolder.getCacheConfiguration(key, cacheManager);
       
        Ehcache newCache = new Cache(cc);
        cache = cacheManager.addCacheIfAbsent(newCache);
    }
View Full Code Here


   {
      if (regionName == null)
      {
         regionName = getDefaultRegion();
      }
      Cache result = cacheManager.getCache(regionName);
      if (result == null)
      {
          log.warn("Could not find configuration for region [" + regionName + "]; using defaults.");
          cacheManager.addCache(regionName);
          result = cacheManager.getCache(regionName);
View Full Code Here

   }

   @Override
   public void remove(String region, String key)
   {
      Cache cache = getCacheRegion(region);
      cache.remove(key);
   }
View Full Code Here

   }

   @Override
   public void put(String region, String key, Object object)
   {
      Cache cache = getCacheRegion(region);
      Element element = new Element(key, object);
      cache.put(element);
   }
View Full Code Here

   public void clear()
   {
      String[] strings = cacheManager.getCacheNames();
      for (String cacheName : strings)
      {
         Cache cache = getCacheRegion(cacheName);
         cache.removeAll();
      }
   }
View Full Code Here

   }

   @Override
   public Object get(String region, String key)
   {
      Cache cache = getCacheRegion(region);
      Element element = cache.get(key);
      if (element != null)
      {
         return element.getObjectValue();
      }
      else
View Full Code Here

    private final MetricRegistry registry = new MetricRegistry();
    private Ehcache cache;

    @Before
    public void setUp() throws Exception {
        final Cache c = new Cache(new CacheConfiguration("test", 100));
        MANAGER.addCache(c);
        this.cache = InstrumentedEhcache.instrument(registry, c);
    }
View Full Code Here

  }

  private Element getCacheElement(int keyAndModelIndex) throws Exception {
    KeyAndModel keyAndModel = getKeyAndModel(keyAndModelIndex);
    EhCacheCachingModel model = (EhCacheCachingModel)keyAndModel.model;
    Cache cache = cacheManager.getCache(model.getCacheName());
    return cache.get(keyAndModel.key);
  }
View Full Code Here

   * @throws CacheNotFoundException if the cache does not exist
   * @throws CacheAccessException   wrapping any unexpected exception thrown by the cache
   */
  protected Cache getCache(String name) throws CacheNotFoundException,
      CacheAccessException {
    Cache cache = null;

    try {
      if (cacheManager.cacheExists(name)) {
        cache = cacheManager.getCache(name);
      }
View Full Code Here

      CacheException cacheException = null;
      int nameCount = cacheNames.length;

      try {
        for (int i = 0; i < nameCount; i++) {
          Cache cache = getCache(cacheNames[i]);
          cache.removeAll();
        }
      } catch (CacheException exception) {
        cacheException = exception;
      } catch (Exception exception) {
        cacheException = new CacheAccessException(exception);
View Full Code Here

TOP

Related Classes of net.sf.ehcache.Cache$CacheStatus

Copyright © 2018 www.massapicom. 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.