Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.opensymphony.oscache.web
Class ServletCache

    java.lang.Object
      com.opensymphony.oscache.base.Cache
          com.opensymphony.oscache.web.ServletCache

All Implemented Interfaces:
  java.util.EventListener, javax.servlet.http.HttpSessionBindingListener, java.io.Serializable

public final class ServletCache
extends Cache
implements javax.servlet.http.HttpSessionBindingListener, java.io.Serializable

A simple extension of Cache that implements a session binding listener, and deletes it's entries when unbound

Version:
  $Revision: 1.3 $
Author:
  Mike Cannon-Brookes, Todd Gochenour, Francois Beauregard
See Also:
  Serialized Form

Field Summary

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, java.lang.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, java.lang.String cronExpiry)` Indicates whether or not the cache entry is stale.
`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, cancelUpdate, clear, completeUpdate, flushAll, flushAll, flushEntry, flushEntry, flushGroup, flushGroup, flushPattern, flushPattern, getCacheEntry, getFromCache, getFromCache, getFromCache, getPersistenceListener, getUpdateState, isFlushed, putInCache, putInCache, putInCache, putInCache, removeCacheEventListener, removeEntry, removeEntry, setCapacity, setPersistenceListener`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ServletCache

    public ServletCache(ServletCacheAdministrator admin,
                        int scope)

  Create a new ServletCache

Parameters:
  `admin` - The ServletCacheAdministrator to administer this ServletCache.
  `scope` - The scope of all entries in this hashmap

### ServletCache

    public ServletCache(ServletCacheAdministrator admin,
                        java.lang.String algorithmClass,
                        int limit,
                        int scope)

  Create a new Cache

Parameters:
  `admin` - The CacheAdministrator to administer this Cache.
  `algorithmClass` - The class that implement an algorithm
  `limit` - The maximum cache size in number of entries
  `scope` - The cache scope

Method Detail

### getScope

    public int getScope()

  Get the cache scope

  Returns:
    The cache scope

### valueBound

    public void valueBound(javax.servlet.http.HttpSessionBindingEvent event)

  When this Cache is bound to the session, do nothing.

  Specified by:
    `valueBound` in interface `javax.servlet.http.HttpSessionBindingListener`
  Parameters:
    `event` - The SessionBindingEvent.

### valueUnbound

    public 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.

  Specified by:
    `valueUnbound` in interface `javax.servlet.http.HttpSessionBindingListener`
  Parameters:
    `event` - The event that triggered this unbinding.

### isStale

    protected boolean isStale(CacheEntry cacheEntry,
                              int refreshPeriod,
                              java.lang.String cronExpiry)

  Indicates whether or not the cache entry is stale. This overrides the `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.

  Overrides:
    `isStale` in class `Cache`
  Parameters:
    `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.
  Returns:
    `true` if the entry is stale, `false` otherwise.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| See www.opensymphony.com for more information.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD