02/28/2005
 

com.vignette.portal.cache
Interface Cache


public interface Cache

Smart map-like objects that store key/value pairs on behalf of callers, with user-defined expiration policies.

It can be tied to an external source with a CacheDataSource to automatically read in values. It can be cluster-aware if it includes a BroadcastingStrategy.

See Also:
CacheFactory, CacheStrategy, CacheDataSource

Method Summary
 Object get(Object key)
          Returns the value associated with key in this cache.
 Object get(Object key, Map properties)
          Returns the value associated with key in this cache.
 Map getAll(Collection keys)
          Returns the values associated with keys in this cache.
 Map getAll(Collection keys, Map properties)
          Returns the values associated with keys in this cache.
 String getName()
          Returns the name of this cache.
 void invalidate(Object key)
          Removes the association for key and its value from this cache.
 void invalidateAll()
          Removes all associations for all keys and their values from this cache.
 void invalidateAll(Collection keys)
          Removes all associations for keys and their values from this cache.
 void put(Object key, Object value)
          Adds an association between key and value into this cache.
 void put(Object key, Object value, Map properties)
          Adds an association between key and value into this cache.
 void putAll(Map keyValuePairs)
          Adds an association for each entry in keyValuePairs into this cache.
 void putAll(Map keyValuePairs, Map properties)
          Adds an association for each entry in keyValuePairs into this cache.
 

Method Detail

getName

public String getName()

Returns the name of this cache.

Returns:
name of this cache

get

public Object get(Object key)
           throws CacheException

Returns the value associated with key in this cache.

If the value is not in this cache and this cache has a CacheDataSource, this cache will call the load method on it to fetch the value and then insert the new value into itself using the put method.

Same as get(key, null).

Parameters:
key - locator for the value to retrieve
Returns:
value associated with key, or null if none

get

public Object get(Object key,
                  Map properties)
           throws CacheException

Returns the value associated with key in this cache.

If the value is not in this cache and this cache has a CacheDataSource, this cache will call the load method on it to fetch the value and then insert the new value into itself using the put method.

Parameters:
key - locator for the value to retrieve
properties - possible overrides for the strategies, can be null
Returns:
value associated with key, or null if none

getAll

public Map getAll(Collection keys)
           throws CacheException

Returns the values associated with keys in this cache.

If some values are not in this cache and this cache has a CacheDataSource, this cache will call the loadAll method on it to fetch the missing values and then insert them into itself using the putAll method.

Same as getAll(keys, null).

Parameters:
keys - locators for the value to retrieve
Returns:
map of key/value associations, with possible null values for keys that do not have an association

getAll

public Map getAll(Collection keys,
                  Map properties)
           throws CacheException

Returns the values associated with keys in this cache.

If some values are not in this cache and this cache has a CacheDataSource, this cache will call the loadAll methods on it to fetch the missing values and then insert them into itself using the putAll method.

Parameters:
keys - locators for the value to retrieve
properties - possible overrides for the strategies, can be null
Returns:
map of key/value associations, with possible null values for keys that do not have an association

put

public void put(Object key,
                Object value)
         throws CacheException

Adds an association between key and value into this cache.

Same as put(key, value, null).

Parameters:
key - locator for the value to insert
value - value to insert

put

public void put(Object key,
                Object value,
                Map properties)
         throws CacheException

Adds an association between key and value into this cache.

Parameters:
key - locator for the value to insert
value - value to insert
properties - possible overrides for the strategies, can be null

putAll

public void putAll(Map keyValuePairs)
            throws CacheException

Adds an association for each entry in keyValuePairs into this cache.

Same as putAll(keyValuePairs, null).

Parameters:
keyValuePairs - key/value pairs to insert

putAll

public void putAll(Map keyValuePairs,
                   Map properties)
            throws CacheException

Adds an association for each entry in keyValuePairs into this cache.

Parameters:
keyValuePairs - key/value pairs to insert
properties - possible overrides for the strategies, can be null

invalidate

public void invalidate(Object key)
                throws CacheException

Removes the association for key and its value from this cache.

Parameters:
key - locator for the value to remove

invalidateAll

public void invalidateAll(Collection keys)
                   throws CacheException

Removes all associations for keys and their values from this cache.

Parameters:
keys - locators for the values to remove

invalidateAll

public void invalidateAll()
                   throws CacheException

Removes all associations for all keys and their values from this cache.


02/28/2005
 

Copyright and Trademark Notices