CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.net.cache
Class MapCacheStore

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.net.cache.AbstractCacheLoader
          extended by com.tangosol.net.cache.AbstractCacheStore
              extended by com.tangosol.net.cache.MapCacheStore
All Implemented Interfaces:
CacheLoader, CacheStore, IterableCacheLoader

public class MapCacheStore
extends AbstractCacheStore
implements CacheStore, IterableCacheLoader

A CacheStore that sits directly on top of a Map.

Since:
Coherence 2.5
Author:
cp 2004.09.24

Constructor Summary
MapCacheStore(Map map)
          Create a CacheStore that delegates to a Map.
 
Method Summary
 void erase(Object oKey)
          Remove the specified key from the underlying store if present.
 void eraseAll(Collection colKeys)
          Remove the specified keys from the underlying store if present.
 Map getMap()
          Returns the Map that this CacheStore uses for its storage.
 Iterator keys()
          Iterate all keys in the underlying store.
 Object load(Object oKey)
          Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.
protected  void setMap(Map map)
          Configures the Map that this CacheStore uses for its storage.
 void store(Object oKey, Object oValue)
          Store the specified value under the specified key in the underlying store.
 void storeAll(Map mapEntries)
          Store the specified values under the specified keys in the underlying store.
 
Methods inherited from class com.tangosol.net.cache.AbstractCacheLoader
loadAll
 
Methods inherited from interface com.tangosol.net.cache.CacheLoader
loadAll
 
Methods inherited from interface com.tangosol.net.cache.CacheLoader
loadAll
 

Constructor Detail

MapCacheStore

public MapCacheStore(Map map)
Create a CacheStore that delegates to a Map.

Parameters:
map - the Map to use as the underlying store for this CacheStore
Method Detail

load

public Object load(Object oKey)
Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.

Specified by:
load in interface CacheLoader
Specified by:
load in class AbstractCacheLoader
Parameters:
oKey - key whose associated value is to be returned
Returns:
the value associated with the specified key, or null if no value is available for that key

store

public void store(Object oKey,
                  Object oValue)
Store the specified value under the specified key in the underlying store. This method is intended to support both key/value creation and value update for a specific key.

Specified by:
store in interface CacheStore
Overrides:
store in class AbstractCacheStore
Parameters:
oKey - key to store the value under
oValue - value to be stored

storeAll

public void storeAll(Map mapEntries)
Store the specified values under the specified keys in the underlying store. This method is intended to support both key/value creation and value update for the specified keys.

Specified by:
storeAll in interface CacheStore
Overrides:
storeAll in class AbstractCacheStore
Parameters:
mapEntries - a Map of any number of keys and values to store

erase

public void erase(Object oKey)
Remove the specified key from the underlying store if present.

Specified by:
erase in interface CacheStore
Overrides:
erase in class AbstractCacheStore
Parameters:
oKey - key to remove from the store

eraseAll

public void eraseAll(Collection colKeys)
Remove the specified keys from the underlying store if present.

Specified by:
eraseAll in interface CacheStore
Overrides:
eraseAll in class AbstractCacheStore
Parameters:
colKeys - keys whose mappings are being removed from the cache

keys

public Iterator keys()
Iterate all keys in the underlying store.

Specified by:
keys in interface IterableCacheLoader
Returns:
a read-only iterator of the keys in the underlying store

getMap

public Map getMap()
Returns the Map that this CacheStore uses for its storage.

Returns:
the Map that this CacheStore uses

setMap

protected void setMap(Map map)
Configures the Map that this CacheStore uses for its storage.

Parameters:
map - the Map that this CacheStore will use

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation