Package net.sf.ehcache

Examples of net.sf.ehcache.Cache


   * {@inheritDoc}
   *
   * @see EhcacheStats#getNumberOfElementsOnDisk(java.lang.String)
   */
  public int getNumberOfElementsOnDisk(String region) {
    Cache cache = this.cacheManager.getCache( region );
    if ( cache != null ) {
      return cache.getDiskStoreSize();
    }
    else {
      return -1;
    }
  }
View Full Code Here


  /**
   * {@inheritDoc}
   */
  public void setStatisticsEnabled(boolean flag) {
    for ( String cacheName : cacheManager.getCacheNames() ) {
      Cache cache = cacheManager.getCache( cacheName );
      if ( cache != null ) {
        cache.setStatisticsEnabled( flag );
      }
    }
    if ( flag ) {
      clearStats();
    }
View Full Code Here

   * {@inheritDoc}
   */
  public long getMaxGetTimeMillis() {
    long rv = 0;
    for ( String cacheName : cacheManager.getCacheNames() ) {
      Cache cache = cacheManager.getCache( cacheName );
      if ( cache != null ) {
        rv = Math.max( rv, cache.getLiveCacheStatistics().getMaxGetTimeMillis() );
      }
    }
    return rv;
  }
View Full Code Here

   * {@inheritDoc}
   */
  public long getMinGetTimeMillis() {
    long rv = 0;
    for ( String cacheName : cacheManager.getCacheNames() ) {
      Cache cache = cacheManager.getCache( cacheName );
      if ( cache != null ) {
        rv = Math.max( rv, cache.getLiveCacheStatistics().getMinGetTimeMillis() );
      }
    }
    return rv;
  }
View Full Code Here

   * {@inheritDoc}
   *
   * @see EhcacheStats#getMaxGetTimeMillis(java.lang.String)
   */
  public long getMaxGetTimeMillis(String cacheName) {
    Cache cache = cacheManager.getCache( cacheName );
    if ( cache != null ) {
      return cache.getLiveCacheStatistics().getMaxGetTimeMillis();
    }
    else {
      return 0;
    }
  }
View Full Code Here

   * {@inheritDoc}
   *
   * @see EhcacheStats#getMinGetTimeMillis(java.lang.String)
   */
  public long getMinGetTimeMillis(String cacheName) {
    Cache cache = cacheManager.getCache( cacheName );
    if ( cache != null ) {
      return cache.getLiveCacheStatistics().getMinGetTimeMillis();
    }
    else {
      return 0;
    }
  }
View Full Code Here

   * {@inheritDoc}
   *
   * @see EhcacheStats#getAverageGetTimeMillis(java.lang.String)
   */
  public float getAverageGetTimeMillis(String region) {
    Cache cache = this.cacheManager.getCache( region );
    if ( cache != null ) {
      return cache.getLiveCacheStatistics().getAverageGetTimeMillis();
    }
    else {
      return -1f;
    }
  }
View Full Code Here

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

        // Cannot overflow to disk as SecurityToken Elements can't be serialized
        @SuppressWarnings("deprecation")
        CacheConfiguration cc = EHCacheManagerHolder.getCacheConfiguration(key, cacheManager)
            .overflowToDisk(false); //tokens not writable
       
        Ehcache newCache = new Cache(cc);
        cache = cacheManager.addCacheIfAbsent(newCache);
       
        // Set the TimeToLive value from the CacheConfiguration
        ttl = cc.getTimeToLiveSeconds();
    }
View Full Code Here

      final CacheManager manager = getCacheManager();
      synchronized(manager)
      {
        if (manager.cacheExists(DATA_CACHE_NAME) == false)
        {
          final Cache libloaderCache = new Cache(DATA_CACHE_NAME,   // cache name
                                                 500,         // maxElementsInMemory
                                                 false,       // overflowToDisk
                                                 false,       // eternal
                                                 600,         // timeToLiveSeconds
                                                 600,         // timeToIdleSeconds
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.