|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.opensymphony.oscache.base.Cache
com.opensymphony.oscache.web.ServletCache
public final class ServletCache
A simple extension of Cache that implements a session binding listener, and deletes it's entries when unbound
Field Summary | |
---|---|
private ServletCacheAdministrator |
admin
The admin for this cache |
private static org.apache.commons.logging.Log |
log
|
private int |
scope
The scope of that cache. |
Fields inherited from class com.opensymphony.oscache.base.Cache |
---|
listenerList, NESTED_EVENT |
Constructor Summary | |
---|---|
ServletCache(ServletCacheAdministrator admin,
int scope)
Create a new ServletCache |
|
ServletCache(ServletCacheAdministrator admin,
String algorithmClass,
int limit,
int scope)
Create a new Cache |
Method Summary | |
---|---|
int |
getScope()
Get the cache scope |
protected boolean |
isStale(CacheEntry cacheEntry,
int refreshPeriod,
String cronExpiry)
Indicates whether or not the cache entry is stale. |
private void |
setScope(int scope)
|
void |
valueBound(javax.servlet.http.HttpSessionBindingEvent event)
When this Cache is bound to the session, do nothing. |
void |
valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
When the users's session ends, all listeners are finalized and the session cache directory is deleted from disk. |
Methods inherited from class com.opensymphony.oscache.base.Cache |
---|
addCacheEventListener, addCacheEventListener, cancelUpdate, clear, completeUpdate, flushAll, flushAll, flushEntry, flushEntry, flushGroup, flushGroup, flushPattern, flushPattern, getCacheEntry, getCacheEventListenerList, getCapacity, getFromCache, getFromCache, getFromCache, getNbEntries, getNbUpdateState, getPersistenceListener, getSize, getUpdateState, isFlushed, putInCache, putInCache, putInCache, putInCache, releaseUpdateState, removeCacheEventListener, removeCacheEventListener, removeEntry, removeEntry, setCapacity, setPersistenceListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final transient org.apache.commons.logging.Log log
private ServletCacheAdministrator admin
private int scope
Constructor Detail |
---|
public ServletCache(ServletCacheAdministrator admin, int scope)
admin
- The ServletCacheAdministrator to administer this ServletCache.scope
- The scope of all entries in this hashmappublic ServletCache(ServletCacheAdministrator admin, String algorithmClass, int limit, int scope)
admin
- The CacheAdministrator to administer this Cache.algorithmClass
- The class that implement an algorithmlimit
- The maximum cache size in number of entriesscope
- The cache scopeMethod Detail |
---|
public int getScope()
private void setScope(int scope)
public void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
valueBound
in interface javax.servlet.http.HttpSessionBindingListener
event
- The SessionBindingEvent.public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
valueUnbound
in interface javax.servlet.http.HttpSessionBindingListener
event
- The event that triggered this unbinding.protected boolean isStale(CacheEntry cacheEntry, int refreshPeriod, String cronExpiry)
Cache.isStale(CacheEntry, int, String)
method to take into account any
flushing that may have been applied to the scope that this cache belongs to.
isStale
in class Cache
cacheEntry
- The cache entry to test the freshness of.refreshPeriod
- The maximum allowable age of the entry, in seconds.cronExpiry
- A cron expression that defines fixed expiry dates and/or
times for this cache entry.
true
if the entry is stale, false
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |