Package net.sf.ehcache

Examples of net.sf.ehcache.Cache


  public static CacheManager getCacheManager() {
    return cacheManager;
  }
 
  static Cache getOrAddCache(String cacheName) {
    Cache cache = cacheManager.getCache(cacheName);
    if (cache == null) {
      synchronized(cacheManager) {
        cache = cacheManager.getCache(cacheName);
        if (cache == null) {
          log.warn("Could not find cache config [" + cacheName + "], using default.");
View Full Code Here


  /**
   * {@inheritDoc}
   */
  public void flushRegionCache(String region) {
    Cache cache = this.cacheManager.getCache( region );
    if ( cache != null ) {
      cache.flush();
    }
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void flushRegionCaches() {
    for ( String name : cacheManager.getCacheNames() ) {
      Cache cache = this.cacheManager.getCache( name );
      if ( cache != null ) {
        cache.flush();
      }
    }

  }
View Full Code Here

   * {@inheritDoc}
   */
  public long getCacheHitCount() {
    long count = 0;
    for ( String name : cacheManager.getCacheNames() ) {
      Cache cache = cacheManager.getCache( name );
      if ( cache != null ) {
        count += cache.getLiveCacheStatistics().getCacheHitCount();
      }
    }
    return count;
  }
View Full Code Here

   * {@inheritDoc}
   */
  public long getCacheHitSample() {
    long count = 0;
    for ( String name : cacheManager.getCacheNames() ) {
      Cache cache = cacheManager.getCache( name );
      if ( cache != null ) {
        count += cache.getSampledCacheStatistics().getCacheHitMostRecentSample();
      }
    }
    return count;
  }
View Full Code Here

   * {@inheritDoc}
   */
  public long getCacheMissCount() {
    long count = 0;
    for ( String name : cacheManager.getCacheNames() ) {
      Cache cache = cacheManager.getCache( name );
      if ( cache != null ) {
        count += cache.getLiveCacheStatistics().getCacheMissCount();
      }
    }
    return count;
  }
View Full Code Here

   * {@inheritDoc}
   */
  public long getCacheMissSample() {
    long count = 0;
    for ( String name : cacheManager.getCacheNames() ) {
      Cache cache = cacheManager.getCache( name );
      if ( cache != null ) {
        count += cache.getSampledCacheStatistics().getCacheMissMostRecentSample();
      }
    }
    return count;
  }
View Full Code Here

   * {@inheritDoc}
   */
  public long getCachePutCount() {
    long count = 0;
    for ( String name : cacheManager.getCacheNames() ) {
      Cache cache = cacheManager.getCache( name );
      if ( cache != null ) {
        count += cache.getLiveCacheStatistics().getPutCount();
      }
    }
    return count;
  }
View Full Code Here

   * {@inheritDoc}
   */
  public long getCachePutSample() {
    long count = 0;
    for ( String name : cacheManager.getCacheNames() ) {
      Cache cache = cacheManager.getCache( name );
      if ( cache != null ) {
        count += cache.getSampledCacheStatistics().getCacheElementPutMostRecentSample();
      }
    }
    return count;
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public int getRegionCacheMaxTTISeconds(String region) {
    Cache cache = cacheManager.getCache( region );
    if ( cache != null ) {
      return (int) cache.getCacheConfiguration().getTimeToIdleSeconds();
    }
    else {
      return -1;
    }
  }
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.