com.scooterframework.cache
Class DefaultCacheStore

java.lang.Object
  extended by com.scooterframework.cache.DefaultCacheStore

public class DefaultCacheStore
extends java.lang.Object

DefaultCacheStore class provides convenient access to default cache.

The default cache provider is defined by default.cache.provider.name property and the default cache name is defined by default.cache.name.

All methods signatures are the same as those defined in Cache interface except that they are all static here.

The default cache and its provider are defined in environment.properties file.


Constructor Summary
DefaultCacheStore()
           
 
Method Summary
static void clear()
          Removes all key/value pairs from cache.
static java.lang.Object get(java.lang.Object key)
          Returns object from cache based on key.
static java.util.Collection<java.lang.Object> getKeys()
          Returns keys in the cache
static java.lang.String getName()
          Returns the cache name.
static boolean put(java.lang.Object key, java.lang.Object obj)
          Stores object into cache based on key.
static boolean remove(java.lang.Object key)
          Removes the mapping for this key from the cache if present.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCacheStore

public DefaultCacheStore()
Method Detail

getName

public static java.lang.String getName()
Returns the cache name.

Returns:
name of the cache

getKeys

public static java.util.Collection<java.lang.Object> getKeys()
Returns keys in the cache

Returns:
a collection of all keys

get

public static java.lang.Object get(java.lang.Object key)
Returns object from cache based on key.

Returns:
the value to which this cache maps the specified key, or null if the cache contains no mapping for this key.

put

public static boolean put(java.lang.Object key,
                          java.lang.Object obj)
Stores object into cache based on key.

Returns:
true if successful

remove

public static boolean remove(java.lang.Object key)
Removes the mapping for this key from the cache if present.

Returns:
true if successful

clear

public static void clear()
Removes all key/value pairs from cache.