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

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

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

Cache.calculateInMemorySize介绍

[英]Gets the size of the memory store for this cache. This method relies on calculating Serialized sizes. If the Element values are not Serializable they will show as zero.

Warning: This method can be very expensive to run. Allow approximately 1 second per 1MB of entries. Running this method could create liveness problems because the object lock is held for a long period
[中]

代码示例

代码示例来源:origin: hibernate/hibernate

public long getSizeInMemory() {
  try {
    return cache.calculateInMemorySize();
  }
  catch(Throwable t) {
    return -1;
  }
}

代码示例来源:origin: org.apache.fulcrum/fulcrum-cache

/**
 * @see org.apache.fulcrum.cache.GlobalCacheService#getCacheSize()
 */
public int getCacheSize() throws IOException
{
  return (int)this.cache.calculateInMemorySize();
}

代码示例来源:origin: lutece-platform/lutece-core

/**
 * {@inheritDoc }
 */
@Override
public long getMemorySize( )
{
  return _cache.calculateInMemorySize( );
}

代码示例来源:origin: lutece-platform/lutece-core

/**
 * {@inheritDoc }
 */
@Override
public long getMemorySize( )
{
  return _cache.calculateInMemorySize( );
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

/**
 * Warning: This method can be very expensive to run. Allow approximately 1 second
 * per 1MB of entries. Running this method could create liveness problems
 * because the object lock is held for a long period
 * <p/>
 *
 * @return the approximate size of memory ehcache is using for the MemoryStore for this cache
 */
public long getSizeInMemory() {
  try {
    return cache.calculateInMemorySize();
  }
  catch (Throwable t) {
    return -1;
  }
}

代码示例来源:origin: org.apache.portals.jetspeed-2/jetspeed-cm

if (calculate)
  state.setInMemorySize(cache.calculateInMemorySize());
  if (calculateObjectCount)

相关文章

微信公众号

最新文章

更多

Cache类方法