| java.lang.Object com.anthonyeden.lib.cache.AbstractCache com.anthonyeden.lib.cache.InMemoryCache
InMemoryCache | public class InMemoryCache extends AbstractCache (Code) | | Cache implementation which stores the cached values in memory.
author: Anthony Eden since: 1.1 |
Constructor Summary | |
public | InMemoryCache() Construct a new InMemoryCache. |
Method Summary | |
public synchronized Object | get(Object key) Get the value for the given key from the cache. | public void | loadConfiguration(Configuration configuration) Load the Cache's configuration from the given Configuration object. | public synchronized void | put(Object key, Object value) Insert a value into the cache. | public synchronized void | put(Object key, Object value, int ttl) Insert a value into the cache with the specified time to live. | public synchronized void | remove(Object key) Remove a value from the cache. |
InMemoryCache | public InMemoryCache()(Code) | | Construct a new InMemoryCache.
|
get | public synchronized Object get(Object key)(Code) | | Get the value for the given key from the cache. This method may
return null if there is no value or the value is expired.
Parameters: key - The key The value or null |
put | public synchronized void put(Object key, Object value)(Code) | | Insert a value into the cache.
Parameters: key - The key Parameters: value - The value |
put | public synchronized void put(Object key, Object value, int ttl)(Code) | | Insert a value into the cache with the specified time to live.
The specified time to live overrides the default time to live.
A value less than 0 is be considered as "infinate".
Parameters: key - The key Parameters: value - The value Parameters: ttl - The time to live |
remove | public synchronized void remove(Object key)(Code) | | Remove a value from the cache.
Parameters: key - The key |
|
|