net.sf.ehcache.Cache.toString()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中net.sf.ehcache.Cache.toString()方法的一些代码示例,展示了Cache.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cache.toString()方法的具体详情如下:
包路径:net.sf.ehcache.Cache
类名称:Cache
方法名:toString

Cache.toString介绍

[英]Returns a String representation of Cache.
[中]返回缓存的字符串表示形式。

代码示例

代码示例来源:origin: apache/cloudstack

@DB()
protected void createCache(final Map<String, ? extends Object> params) {
  final String value = (String)params.get("cache.size");
  if (value != null) {
    final CacheManager cm = CacheManager.create();
    final int maxElements = NumbersUtil.parseInt(value, 0);
    final int live = NumbersUtil.parseInt((String)params.get("cache.time.to.live"), 300);
    final int idle = NumbersUtil.parseInt((String)params.get("cache.time.to.idle"), 300);
    _cache = new Cache(getName(), maxElements, false, live == -1, live == -1 ? Integer.MAX_VALUE : live, idle);
    cm.addCache(_cache);
    s_logger.info("Cache created: " + _cache.toString());
  } else {
    _cache = null;
  }
}

代码示例来源:origin: naver/arcus-java-client

@Override
public String toString() {
 return cache.toString();
}

代码示例来源:origin: edu.ucar/netcdf

public void stats() {
 System.out.printf(" elems added= %s%n", addElements.get());
 System.out.printf(" reqs= %d%n", requests.get());
 System.out.printf(" hits= %d%n", hits.get());
 if (cache != null) {
  System.out.printf(" cache= %s%n", cache.toString());
  System.out.printf(" cache.size= %d%n", cache.getSize());
  System.out.printf(" cache.memorySize= %d%n", cache.getMemoryStoreSize());
  Statistics stats = cache.getStatistics();
  System.out.printf(" stats= %s%n", stats.toString());
 }
}

代码示例来源:origin: MissionCriticalCloud/cosmic

@DB()
protected void createCache(final Map<String, ? extends Object> params) {
  final String value = (String) params.get("cache.size");
  if (value != null) {
    final CacheManager cm = CacheManager.create();
    final int maxElements = NumbersUtil.parseInt(value, 0);
    final int live = NumbersUtil.parseInt((String) params.get("cache.time.to.live"), 300);
    final int idle = NumbersUtil.parseInt((String) params.get("cache.time.to.idle"), 300);
    _cache = new Cache(getName(), maxElements, false, live == -1, live == -1 ? Integer.MAX_VALUE : live, idle);
    cm.addCache(_cache);
    s_logger.info("Cache created: " + _cache.toString());
  } else {
    _cache = null;
  }
}

代码示例来源:origin: naver/arcus-java-client

public LocalCacheManager(String name, int max, int exptime, boolean copyOnRead, boolean copyOnWrite) {
 this.cache = CacheManager.getInstance().getCache(name);
 if (cache == null) {
  CacheConfiguration config =
      new CacheConfiguration(name, max)
          .copyOnRead(copyOnRead)
          .copyOnWrite(copyOnWrite)
          .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LRU)
          .eternal(false)
          .timeToLiveSeconds(exptime)
          .timeToIdleSeconds(exptime)
          .diskExpiryThreadIntervalSeconds(60)
          .persistence(new PersistenceConfiguration().strategy(PersistenceConfiguration.Strategy.NONE));
  this.cache = new Cache(config, null, null);
  CacheManager.getInstance().addCache(cache);
  if (logger.isInfoEnabled()) {
   logger.info("Arcus k/v local cache is enabled : %s", cache.toString());
  }
 }
}

相关文章

Cache类方法