Package net.sf.ehcache

Examples of net.sf.ehcache.Cache


            cacheManager = CacheManager.create(conf);
        }
       
        CacheConfiguration cc = EHCacheUtil.getCacheConfiguration(key, cacheManager);
       
        Ehcache newCache = new Cache(cc);
        cache = cacheManager.addCacheIfAbsent(newCache);
    }
View Full Code Here


                in.setBody("Hello World");
            }
        });

        CacheManager cm = cacheEndpoint.getCacheManagerFactory().getInstance();
        Cache cache = cm.getCache(cacheEndpoint.getConfig().getCacheName());
        Set<CacheEventListener> ehcacheEventListners = cache.getCacheEventNotificationService().getCacheEventListeners();
        List<CacheLoader> cacheLoaders = cache.getRegisteredCacheLoaders();
        CacheEventListenerRegistry configuredEventRegistry = cacheEndpoint.getConfig().getEventListenerRegistry();
        CacheLoaderRegistry configuredLoaderRegistry = cacheEndpoint.getConfig().getCacheLoaderRegistry();

        //Test if CacheEventListenerRegistry was referenced correctly
        assertEquals("CacheEventListenerRegistry size", 1, configuredEventRegistry.size());
View Full Code Here

        //Now should not be null
        CacheManager cacheManager = cmfRef.getCacheManager();
        assertNotNull("CacheManager initialized", cacheManager);

        Cache cache = cmfRef.getCacheManager().getCache("foo");

        // Is cache alive
        assertEquals("Is cache still alive", Status.STATUS_ALIVE, cache.getStatus());

        context.stopRoute(ROUTE1_ID);

        // Is cache still alive?
        assertEquals("Is cache still alive", Status.STATUS_ALIVE, cache.getStatus());

        context.stop();

        // Was the cache shutdowned with context?
        assertEquals("Is cache still alive", Status.STATUS_SHUTDOWN, cache.getStatus());
    }
View Full Code Here

      }
    }

    if (manager.cacheExists(CACHE_NAME) == false)
    {
      cache = new Cache(CACHE_NAME,  // cache name
          500,         // maxElementsInMemory
          false,       // overflowToDisk
          false,       // eternal
          600,         // timeToLiveSeconds
          600,         // timeToIdleSeconds
View Full Code Here

    return maximumRows;
  }

  public TableModel get(final DataCacheKey key)
  {
    final Cache cache = this.cache;
    synchronized (this)
    {
      if (cache == null)
      {
        return null;
      }

      if (cache.getStatus() != Status.STATUS_ALIVE)
      {
        this.cache = null;
        return null;
      }
    }

    final Element element = cache.get(key);
    if (element == null)
    {
      return null;
    }
    return (TableModel) element.getObjectValue();
View Full Code Here

    if (CachableTableModel.isSafeToCache(model) == false)
    {
      return model;
    }

    final Cache cache;
    synchronized (this)
    {
      initialize();
      cache = this.cache;
    }

    final TableModel cacheModel = new CachableTableModel(model);
    cache.put(new Element(key, cacheModel));
    return cacheModel;
  }
View Full Code Here

    //~ Methods ========================================================================================================
    @BeforeClass
    public static void initCacheManaer() {
        cacheManager = CacheManager.create();
        cacheManager.addCache(new Cache("castickets", 500, false, false, 30, 30));
    }
View Full Code Here

    //~ Methods ========================================================================================================
    @BeforeClass
    public static void initCacheManaer() {
        cacheManager = CacheManager.create();
        cacheManager.addCache(new Cache("basiclookuptestcache", 500, false, false, 30, 30));
    }
View Full Code Here

    //~ Methods ========================================================================================================
    @BeforeClass
    public static void initCacheManaer() {
        cacheManager = CacheManager.create();
        cacheManager.addCache(new Cache("ehcacheusercachetests", 500, false, false, 30, 30));
    }
View Full Code Here

    public EHCacheReplayCache(String key, CacheManager cacheManager) {
        this.cacheManager = cacheManager;
       
        CacheConfiguration cc = EHCacheManagerHolder.getCacheConfiguration(key, cacheManager);

        Ehcache newCache = new Cache(cc);
        cache = cacheManager.addCacheIfAbsent(newCache);

        // Set the TimeToLive value from the CacheConfiguration
        ttl = cc.getTimeToLiveSeconds();
    }
View Full Code Here

TOP

Related Classes of net.sf.ehcache.Cache

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.