org.apache.cocoon.components.store.impl
Class EHDefaultStore

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.store.impl.EHDefaultStore
All Implemented Interfaces:
Disposable, Initializable, Component, Contextualizable, LogEnabled, Parameterizable, Serviceable, ThreadSafe, Store

public class EHDefaultStore
extends AbstractLogEnabled
implements Store, Contextualizable, Serviceable, Parameterizable, Initializable, Disposable, ThreadSafe

Store implementation based on EHCache. (http://ehcache.sourceforge.net/)

Version:
$Id: EHDefaultStore.html 1304258 2012-03-23 10:09:27Z ilgrosso $

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 contextualize(Context context)
           
 void dispose()
          Shutdown the CacheManager.
 void free()
           
 Object get(Object key)
           
 void initialize()
          Initialize the CacheManager and created the Cache.
 Enumeration keys()
           
 void parameterize(Parameters parameters)
          Configure the store.
 void remove(Object key)
           
 void service(ServiceManager aManager)
           
 int size()
           
 void store(Object key, Object value)
           
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EHDefaultStore

public EHDefaultStore()
Method Detail

contextualize

public void contextualize(Context context)
                   throws ContextException
Specified by:
contextualize in interface Contextualizable
Throws:
ContextException

service

public void service(ServiceManager aManager)
             throws ServiceException
Specified by:
service in interface Serviceable
Throws:
ServiceException

parameterize

public void parameterize(Parameters parameters)
                  throws ParameterException
Configure the store. The following options can be used:

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.

Specified by:
parameterize in interface Parameterizable
Throws:
ParameterException

initialize

public void initialize()
                throws Exception
Initialize the CacheManager and created the Cache.

Specified by:
initialize in interface Initializable
Throws:
Exception

dispose

public void dispose()
Shutdown the CacheManager.

Specified by:
dispose in interface Disposable

get

public Object get(Object key)
Specified by:
get in interface Store

store

public void store(Object key,
                  Object value)
           throws IOException
Specified by:
store in interface Store
Throws:
IOException

free

public void free()
Specified by:
free in interface Store

remove

public void remove(Object key)
Specified by:
remove in interface Store

clear

public void clear()
Specified by:
clear in interface Store

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Store

keys

public Enumeration keys()
Specified by:
keys in interface Store

size

public int size()
Specified by:
size in interface Store


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.