ehcache

net.sf.ehcache.config
Class Configuration.Cache

java.lang.Object
  extended bynet.sf.ehcache.config.Configuration.Cache
Direct Known Subclasses:
Configuration.DefaultCache
Enclosing class:
Configuration

public static class Configuration.Cache
extends java.lang.Object

A class to represent Cache configuration e.g.


Field Summary
protected  long diskExpiryThreadIntervalSeconds
          The interval in seconds between runs of the disk expiry thread.
protected  boolean diskPersistent
          For caches that overflow to disk, does the disk cache persist between CacheManager instances?
protected  boolean eternal
          Sets whether elements are eternal.
protected  int maxElementsInMemory
          the maximum objects to be held in memory
protected  java.lang.String name
          the name of the cache
protected  boolean overflowToDisk
          whether elements can overflow to disk when the in-memory cache has reached the set limit.
protected  int timeToIdleSeconds
          the time to idle for an element before it expires.
protected  int timeToLiveSeconds
          Sets the time to idle for an element before it expires.
 
Constructor Summary
Configuration.Cache()
           
 
Method Summary
 void setDiskExpiryThreadIntervalSeconds(int diskExpiryThreadIntervalSeconds)
          Sets the interval in seconds between runs of the disk expiry thread.
 void setDiskPersistent(boolean diskPersistent)
          Sets whether, for caches that overflow to disk, the disk cache persist between CacheManager instances
 void setEternal(boolean eternal)
          Sets whether elements are eternal.
 void setMaxElementsInMemory(int maxElementsInMemory)
          Sets the maximum objects to be held in memory
 void setName(java.lang.String name)
          Sets the name of the cache.
 void setOverflowToDisk(boolean overflowToDisk)
          Sets whether elements can overflow to disk when the in-memory cache has reached the set limit.
 void setTimeToIdleSeconds(int timeToIdleSeconds)
          Sets the time to idle for an element before it expires.
 void setTimeToLiveSeconds(int timeToLiveSeconds)
          Sets the time to idle for an element before it expires.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
the name of the cache


maxElementsInMemory

protected int maxElementsInMemory
the maximum objects to be held in memory


eternal

protected boolean eternal
Sets whether elements are eternal. If eternal, timeouts are ignored and the element is never expired.


timeToIdleSeconds

protected int timeToIdleSeconds
the time to idle for an element before it expires. Is only used if the element is not eternal.A value of 0 means do not check for idling.


timeToLiveSeconds

protected int timeToLiveSeconds
Sets the time to idle for an element before it expires. Is only used if the element is not eternal. This attribute is optional in the configuration. A value of 0 means do not check time to live.


overflowToDisk

protected boolean overflowToDisk
whether elements can overflow to disk when the in-memory cache has reached the set limit.


diskPersistent

protected boolean diskPersistent
For caches that overflow to disk, does the disk cache persist between CacheManager instances?


diskExpiryThreadIntervalSeconds

protected long diskExpiryThreadIntervalSeconds
The interval in seconds between runs of the disk expiry thread.

2 minutes is the default. This is not the same thing as time to live or time to idle. When the thread runs it checks these things. So this value is how often we check for expiry.

Constructor Detail

Configuration.Cache

public Configuration.Cache()
Method Detail

setName

public void setName(java.lang.String name)
Sets the name of the cache. This must be unique


setMaxElementsInMemory

public void setMaxElementsInMemory(int maxElementsInMemory)
Sets the maximum objects to be held in memory


setEternal

public void setEternal(boolean eternal)
Sets whether elements are eternal. If eternal, timeouts are ignored and the element is never expired.


setTimeToIdleSeconds

public void setTimeToIdleSeconds(int timeToIdleSeconds)
Sets the time to idle for an element before it expires. Is only used if the element is not eternal.


setTimeToLiveSeconds

public void setTimeToLiveSeconds(int timeToLiveSeconds)
Sets the time to idle for an element before it expires. Is only used if the element is not eternal.


setOverflowToDisk

public void setOverflowToDisk(boolean overflowToDisk)
Sets whether elements can overflow to disk when the in-memory cache has reached the set limit.


setDiskPersistent

public void setDiskPersistent(boolean diskPersistent)
Sets whether, for caches that overflow to disk, the disk cache persist between CacheManager instances


setDiskExpiryThreadIntervalSeconds

public void setDiskExpiryThreadIntervalSeconds(int diskExpiryThreadIntervalSeconds)
Sets the interval in seconds between runs of the disk expiry thread.

2 minutes is the default. This is not the same thing as time to live or time to idle. When the thread runs it checks these things. So this value is how often we check for expiry.


ehcache