JSecurity

org.jsecurity.cache
Interface Cache

All Known Implementing Classes:
EhCache, HashtableCache

public interface Cache

A Cache efficiently stores temporary objects primarily to improve an application's performance.

JSecurity doesn't implement a full Cache mechanism itself, since that is outside the core competency of a Security framework. Instead, this interface provides an abstraction (wrapper) API on top of an underlying cache framework's cache instance (e.g. JCache, Ehcache, JCS, OSCache, JBossCache, TerraCotta, Coherence, GigaSpaces, etc, etc), allowing a JSecurity user to configure any cache mechanism they choose.

Since:
0.2
Author:
Les Hazlewood, Jeremy Haile

Method Summary
 void clear()
          Clear all entries from the cache.
 Object get(Object key)
          Returns the Cached value stored under the specified key or null if there is no Cache entry for that key.
 Set keys()
          Returns a view of all the keys for entries contained in this cache.
 void put(Object key, Object value)
          Adds a Cache entry.
 void remove(Object key)
          Remove the cache entry corresponding to the specified key.
 int size()
          Returns the number of entries in the cache.
 Set values()
          Returns a view of all of the values contained in this cache.
 

Method Detail

get

Object get(Object key)
           throws CacheException
Returns the Cached value stored under the specified key or null if there is no Cache entry for that key.

Parameters:
key - the key that the value was previous added with
Returns:
the cached object or null if there is no Cache entry for the specified key
Throws:
CacheException - if there is a problem accessing the underlying cache system

put

void put(Object key,
         Object value)
         throws CacheException
Adds a Cache entry.

Parameters:
key - the key used to identify the object being stored.
value - the value to be stored in the cache.
Throws:
CacheException - if there is a problem accessing the underlying cache system

remove

void remove(Object key)
            throws CacheException
Remove the cache entry corresponding to the specified key.

Parameters:
key - the key of the entry to be removed.
Throws:
CacheException - if there is a problem accessing the underlying cache system

clear

void clear()
           throws CacheException
Clear all entries from the cache.

Throws:
CacheException - if there is a problem accessing the underlying cache system

size

int size()
Returns the number of entries in the cache.

Returns:
the number of entries in the cache.

keys

Set keys()
Returns a view of all the keys for entries contained in this cache.

Returns:
a view of all the keys for entries contained in this cache.

values

Set values()
Returns a view of all of the values contained in this cache.

Returns:
a view of all of the values contained in this cache.

JSecurity

Copyright © 2004-2008 JSecurity.