Package net.sf.ehcache

Examples of net.sf.ehcache.Cache


  /**
   * {@inheritDoc}
   */
  public int getRegionCacheMaxTTLSeconds(String region) {
    Cache cache = cacheManager.getCache( region );
    if ( cache != null ) {
      return (int) cache.getCacheConfiguration().getTimeToLiveSeconds();
    }
    else {
      return -1;
    }
  }
View Full Code Here


  /**
   * {@inheritDoc}
   */
  public int getRegionCacheOrphanEvictionPeriod(String region) {
    Cache cache = this.cacheManager.getCache( region );
    if ( cache != null && cache.isTerracottaClustered() ) {
      return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictionPeriod();
    }
    else {
      return -1;
    }
  }
View Full Code Here

   * {@inheritDoc}
   */
  public Map<String, int[]> getRegionCacheSamples() {
    Map<String, int[]> rv = new HashMap<String, int[]>();
    for ( String name : cacheManager.getCacheNames() ) {
      Cache cache = cacheManager.getCache( name );
      if ( cache != null ) {
        rv.put(
            name, new int[] {
            (int) cache.getSampledCacheStatistics().getCacheHitMostRecentSample(),
            (int) ( cache.getSampledCacheStatistics().getCacheMissNotFoundMostRecentSample()
                + cache.getSampledCacheStatistics().getCacheMissExpiredMostRecentSample() ),
            (int) cache.getSampledCacheStatistics().getCacheElementPutMostRecentSample(),
        }
        );
      }
    }
    return rv;
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public int getRegionCacheTargetMaxInMemoryCount(String region) {
    Cache cache = cacheManager.getCache( region );
    if ( cache != null ) {
      return cache.getCacheConfiguration().getMaxElementsInMemory();
    }
    else {
      return -1;
    }
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public int getRegionCacheTargetMaxTotalCount(String region) {
    Cache cache = cacheManager.getCache( region );
    if ( cache != null ) {
      return cache.getCacheConfiguration().getMaxElementsOnDisk();
    }
    else {
      return -1;
    }
  }
View Full Code Here

   * {@inheritDoc}
   */
  public String[] getTerracottaHibernateCacheRegionNames() {
    ArrayList<String> rv = new ArrayList<String>();
    for ( String name : cacheManager.getCacheNames() ) {
      Cache cache = cacheManager.getCache( name );
      if ( cache != null ) {
        if ( cache.getCacheConfiguration().isTerracottaClustered() ) {
          rv.add( name );
        }
      }
    }
    return rv.toArray( new String[] { } );
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public boolean isRegionCacheEnabled(String region) {
    Cache cache = this.cacheManager.getCache( region );
    if ( cache != null ) {
      return !cache.isDisabled();
    }
    else {
      return false;
    }
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void setRegionCacheEnabled(String region, boolean enabled) {
    Cache cache = this.cacheManager.getCache( region );
    if ( cache != null ) {
      cache.setDisabled( !enabled );
    }
    sendNotification( CACHE_REGION_CHANGED, getRegionCacheAttributes( region ), region );
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public boolean isRegionCachesEnabled() {
    for ( String name : this.cacheManager.getCacheNames() ) {
      Cache cache = this.cacheManager.getCache( name );
      if ( cache != null ) {
        if ( cache.isDisabled() ) {
          return false;
        }
      }
    }
    return true;
View Full Code Here

  /**
   * @see EhcacheStats#setRegionCachesEnabled(boolean)
   */
  public void setRegionCachesEnabled(final boolean flag) {
    for ( String name : this.cacheManager.getCacheNames() ) {
      Cache cache = this.cacheManager.getCache( name );
      if ( cache != null ) {
        cache.setDisabled( !flag );
      }
    }
    sendNotification( CACHE_ENABLED, flag );
  }
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.