Package net.sf.ehcache

Examples of net.sf.ehcache.CacheManager


    }

    public void setUp()
        throws Exception
    {
        CacheManager m_cacheManager = CacheManager.getInstance();
        m_cacheManager.clearAll();
        m_cacheManager.removalAll();

        m_engine  = new TestEngine(props);
        m_manager = m_engine.getAttachmentManager();

        m_engine.saveText( NAME1, "Foobar" );
View Full Code Here


     */
    public void initialize() throws Exception
    {
        if (this.configFile == null)
        {
            this.cacheManager = new CacheManager();
            this.cacheManager.addCache(this.cacheName);
        }
        else
        {
            this.cacheManager = new CacheManager(this.configFile);
        }
       
        this.cache = this.cacheManager.getCache(this.cacheName);
       
        // Start housekeeping thread.
View Full Code Here

    refreshList.add(
      new Refreshee( uri, System.currentTimeMillis() + refreshRate, refreshType ) );
  }
 
  protected Cache getCache() {
    CacheManager cacheManager = null;
    Cache cache = null;
    try {
      cacheManager = CacheManagerFactory.getDefaultCacheManager();
    } catch ( CacheException e ) {
      getLogger().log(
        name + ": Error getting default CacheManager.",
        e,
        LOG_CHANNEL,
        Logger.ERROR );
      return null;
    }
    cache = cacheManager.getCache( CACHE_NAME );
    if ( cache == null ) {
      cache = new Cache(
        CACHE_NAME,
        DEFAULT_CACHE_SIZE,
        DEFAULT_CACHE_OVERFLOW_TO_DISK,
        DEFAULT_CACHE_ETERNAL,
        DEFAULT_CACHE_TTL,
        DEFAULT_CACHE_TTI );
      try {
        cacheManager.addCache(cache);
      } catch ( IllegalStateException e ) {
        getLogger().log(
          name + ": Error adding cache \"" + CACHE_NAME + "\" to CacheManager.",
          e,
          LOG_CHANNEL,
View Full Code Here

   * @param configFilePath path to the configuration file to use.
   * @return a CacheManager
   * @throws CacheException
   */
  public static CacheManager getCacheManager( String configFilePath ) throws CacheException {
    CacheManager cm = (CacheManager)cacheManagers.get( configFilePath );
    if ( cm == null ) {
      cm = CacheManager.create( configFilePath );
    }
    return cm;
  }
View Full Code Here

   * @param configFileURL URL to the configuration file to use.
   * @return a CacheManager
   * @throws CacheException
   */
  public static CacheManager getCacheManager( URL configFileURL ) throws CacheException {
    CacheManager cm = (CacheManager)cacheManagers.get( configFileURL );
    if ( cm == null ) {
      cm = CacheManager.create( configFileURL );
    }
    return cm;
  }
View Full Code Here

    @Override
    protected void mergeTemplate(Template template, Context context, HttpServletResponse response) throws Exception {
        try {
            EhCacheCacheManager ehCacheCacheManager = (EhCacheCacheManager) getAttributesMap().get("ehCacheCacheManager");
            CacheManager cacheManager = ehCacheCacheManager.getCacheManager();
            String cacheName = (String) getAttributesMap().get("cacheName");
            Cache cache = cacheManager != null && StringUtils.isNotEmpty(cacheName) ? cacheManager.getCache(cacheName) : null;

            HttpServletRequest request = ((ChainedContext) context).getRequest();
            boolean isGet = StringUtils.equals("GET", request.getMethod());

            Object contextUseCache = context.get("useCache");
View Full Code Here

            defaultConfig.setTimeToLiveSeconds(120);
            defaultConfig.setDiskPersistent(false);
            defaultConfig.setDiskExpiryThreadIntervalSeconds(120);
            config.addDefaultCache(defaultConfig);
           
            _cacheManager = new CacheManager(config);
        }
        return _cacheManager;
       
       
    }
View Full Code Here

            defaultConfig.setTimeToLiveSeconds(120);
            defaultConfig.setDiskPersistent(false);
            defaultConfig.setDiskExpiryThreadIntervalSeconds(120);
            config.addDefaultCache(defaultConfig);

            _cacheManager = new CacheManager(config);
        }
        return _cacheManager;

    }
View Full Code Here

        if (_ehcache == null) {
            return;
        }

        try {
            CacheManager cacheManager = getCacheManager();
            cacheManager.removeCache(_name);
        }
        catch (CacheException e) {
            throw new de.innovationgate.utils.cache.CacheException("Exception closing ehcache", e);
        }
    }
View Full Code Here

        // EhCache in disabled-like-mode
        Configuration ehCacheConfig = new Configuration();
        CacheConfiguration defaultCache = new CacheConfiguration("default", 1).eternal(false).timeToIdleSeconds(30)
                .timeToLiveSeconds(30).overflowToDisk(false);
        ehCacheConfig.addDefaultCache(defaultCache);
        CacheService cacheService = new CacheService(new CacheManager(ehCacheConfig));
        directoryService.setCacheService(cacheService);

        // Init the schema
        // SchemaLoader loader = new SingleLdifSchemaLoader();
        SchemaLoader loader = new JarLdifSchemaLoader();
View Full Code Here

TOP

Related Classes of net.sf.ehcache.CacheManager

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.