|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.components.store.impl.EHDefaultStore
Store implementation based on EHCache (http://ehcache.sourceforge.net/) Configure the store using the setter methods.
Setting eternal
to false
but not setting
timeToLiveSeconds
and/or timeToIdleSeconds
, has the
same effect as setting eternal
to true
.
Here is an example to clarify the purpose of the timeToLiveSeconds
and
timeToIdleSeconds
parameters:
With these settings the entry will be removed from the cache after 24 hours. If within that 24-hour period the entry is not retrieved within 3 hours after the last retrieval, it will also be removed from the cache.
By setting timeToLiveSeconds
to 0
, an item can stay in
the cache as long as it is retrieved within timeToIdleSeconds
after the
last retrieval.
By setting timeToIdleSeconds
to 0
, an item will stay in
the cache for exactly timeToLiveSeconds
.
disk-persistent
Whether the disk store persists between restarts of
the Virtual Machine. The default value is true.
Field Summary |
Fields inherited from interface org.apache.excalibur.store.Store |
PERSISTENT_STORE, ROLE, TRANSIENT_STORE |
Constructor Summary | |
EHDefaultStore()
|
Method Summary | |
void |
clear()
|
boolean |
containsKey(Object key)
|
void |
destroy()
Shutdown the CacheManager. |
void |
free()
|
Object |
get(Object key)
|
Log |
getLogger()
|
void |
init()
Initialize the CacheManager and created the Cache. |
Enumeration |
keys()
|
void |
remove(Object key)
|
void |
setBootstrapCacheLoader(net.sf.ehcache.bootstrap.BootstrapCacheLoader bootstrapCacheLoader)
The BootstrapCacheLoader to use to populate the cache when it is first initialised. |
void |
setDirectory(String directory)
directory Specify an alternative location of the disk store. |
void |
setDiskExpiryThreadIntervalSeconds(int diskExpiryThreadIntervalSeconds)
diskExpiryThreadIntervalSeconds (120) - The number of seconds
between runs of the disk expiry thread. |
void |
setDiskPersistent(boolean diskPersistent)
disk-persistent Whether the disk store persists between restarts of
the Virtual Machine. |
void |
setEternal(boolean eternal)
eternal (true) - whether or not entries expire. |
void |
setLogger(Log l)
|
void |
setMaxDiskObjects(int maxDiskObjects)
maxDiskObjects (50000) - The maximum number of disc objects. |
void |
setMaxMemObjects(int maxMemObjects)
maxMemobjects (10000) - The maximum number of in-memory objects. |
void |
setMemoryStoreEvictionPolicy(net.sf.ehcache.store.MemoryStoreEvictionPolicy memoryStoreEvictionPolicy)
memoryStoreEvictionPolicy (null) - Tone of LRU, LFU and FIFO. |
void |
setOverflowToDisk(boolean overflowToDisk)
overflow-to-disk (true) - Whether to spool elements to disk after
maxobjects has been exceeded. |
void |
setRegisteredEventListeners(net.sf.ehcache.event.RegisteredEventListeners registeredEventListeners)
A notification service. |
void |
setSettings(org.apache.cocoon.configuration.Settings settings)
|
void |
setStoreJanitor(StoreJanitor storeJanitor)
Use the StoreJanitor to take care of freeing memory. |
void |
setTimeToIdleSeconds(long timeToIdleSeconds)
timeToIdleSeconds (0) - the maximum time between retrievals
of an entry. |
void |
setTimeToLiveSeconds(long timeToLiveSeconds)
timeToLiveSeconds (0) - how long an entry may live in the cache
before it is removed. |
void |
setUseCacheDirectory(boolean useCacheDirectory)
use-cache-directory (false) - If true the cache-directory
context entry will be used as the location of the disk store. |
void |
setUseWorkDirectory(boolean useWorkDirectory)
use-work-directory (false) - If true the work-directory
context entry will be used as the location of the disk store. |
int |
size()
|
void |
store(Object key,
Object value)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EHDefaultStore()
Method Detail |
public void setDirectory(String directory)
directory
Specify an alternative location of the disk store.
directory
- Specify an alternative location of the disk store.public void setDiskPersistent(boolean diskPersistent)
disk-persistent
Whether the disk store persists between restarts of
the Virtual Machine. The default value is true.
diskPersistent
- public void setEternal(boolean eternal)
eternal
(true) - whether or not entries expire. When set to
false
the timeToLiveSeconds
and
timeToIdleSeconds
parameters are used to determine when an
item expires.
eternal
- public void setMaxMemObjects(int maxMemObjects)
maxMemobjects
(10000) - The maximum number of in-memory objects.
maxMemObjects
- public void setMaxDiskObjects(int maxDiskObjects)
maxDiskObjects
(50000) - The maximum number of disc objects.
maxDiskObjects
- public void setOverflowToDisk(boolean overflowToDisk)
overflow-to-disk
(true) - Whether to spool elements to disk after
maxobjects has been exceeded.
overflowToDisk
- public void setTimeToIdleSeconds(long timeToIdleSeconds)
timeToIdleSeconds
(0) - the maximum time between retrievals
of an entry. If the entry is not retrieved for this period, it is removed from the
cache.
timeToIdleSeconds
- public void setTimeToLiveSeconds(long timeToLiveSeconds)
timeToLiveSeconds
(0) - how long an entry may live in the cache
before it is removed. The entry will be removed no matter how frequently it is retrieved.
timeToLiveSeconds
- public void setDiskExpiryThreadIntervalSeconds(int diskExpiryThreadIntervalSeconds)
diskExpiryThreadIntervalSeconds
(120) - The number of seconds
between runs of the disk expiry thread.
diskExpiryThreadIntervalSeconds
- public void setMemoryStoreEvictionPolicy(net.sf.ehcache.store.MemoryStoreEvictionPolicy memoryStoreEvictionPolicy)
memoryStoreEvictionPolicy
(null) - Tone of LRU, LFU and FIFO. If
null, it will be set to LRU.
memoryStoreEvictionPolicy
- public void setRegisteredEventListeners(net.sf.ehcache.event.RegisteredEventListeners registeredEventListeners)
registeredEventListeners
- public void setBootstrapCacheLoader(net.sf.ehcache.bootstrap.BootstrapCacheLoader bootstrapCacheLoader)
bootstrapCacheLoader
- public void setUseCacheDirectory(boolean useCacheDirectory)
use-cache-directory
(false) - If true the cache-directory
context entry will be used as the location of the disk store.
Within the servlet environment this is set in web.xml.
useCacheDirectory
- public void setUseWorkDirectory(boolean useWorkDirectory)
use-work-directory
(false) - If true the work-directory
context entry will be used as the location of the disk store.
Within the servlet environment this is set in web.xml.
useWorkDirectory
- public void setSettings(org.apache.cocoon.configuration.Settings settings)
settings
- the settings to setpublic void setStoreJanitor(StoreJanitor storeJanitor)
StoreJanitor
to take care of freeing memory.
storeJanitor
- public Log getLogger()
public void setLogger(Log l)
public void init() throws Exception
Exception
public void destroy()
public Object get(Object key)
get
in interface Store
Store.free()
public void store(Object key, Object value) throws IOException
store
in interface Store
IOException
Store.free()
public void free()
free
in interface Store
Store.free()
public void remove(Object key)
remove
in interface Store
Store.remove(java.lang.Object)
public void clear()
clear
in interface Store
Store.clear()
public boolean containsKey(Object key)
containsKey
in interface Store
Store.containsKey(java.lang.Object)
public Enumeration keys()
keys
in interface Store
Store.keys()
public int size()
size
in interface Store
Store.size()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |