org.cdlib.xtf.cache
Class StringCache
Object
Cache<K,V>
SimpleCache
StringCache
public class StringCache
- extends SimpleCache
This class caches mappings from a string to a string.
Field Summary |
String |
cacheName
Name of the cache, printed by logAction() |
Constructor Summary |
StringCache(String cacheName,
int maxEntries,
int maxTime)
Constructor - establishes the cache. |
Method Summary |
String |
get(String key)
Get the value corresponding to the given key |
protected void |
logAction(String action,
Object key,
Object value)
Print out useful debug info |
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
cacheName
public String cacheName
- Name of the cache, printed by logAction()
StringCache
public StringCache(String cacheName,
int maxEntries,
int maxTime)
- Constructor - establishes the cache.
- Parameters:
cacheName
- Name to print out in logAction()maxEntries
- Max # of entries before old ones are flushed.maxTime
- Max age (in seconds) of entries before flushed.
get
public String get(String key)
- Get the value corresponding to the given key
- Parameters:
key
- The key to look for
- Returns:
- Corresponding value, or null if key not found.
logAction
protected void logAction(String action,
Object key,
Object value)
- Print out useful debug info
- Overrides:
logAction
in class Cache
- Parameters:
action
- What happened ("Added", "Removed", etc.)key
- The key involved in the actionvalue
- The value involved in the action