|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.continuent.tungsten.common.cache.IndexedLRUCache<T>
public class IndexedLRUCache<T>
Implements a self-managing cache suitable for database metadata. The cache has a specific capacity which is maintained by invalidating cache nodes implicitly using an LRU (least recently used) algorithm. Clients can also invalidate individual keys, key ranges, and the entire cache.
NOTE: The cache is designed for use by a single thread. There is no synchronization, nor do we have a notion of "loans."
| Constructor Summary | |
|---|---|
IndexedLRUCache(int capacity,
CacheResourceManager<T> resourceManager)
Creates a new prepared statement cache. |
|
| Method Summary | |
|---|---|
T |
get(java.lang.String key)
Retrieves a value or returns null if it is not in the cache. |
int |
invalidate(java.lang.String key)
Release the value corresponding to a specific key, returning the number of items deleted. |
int |
invalidateAll()
Invalidate all values in the cache, returning number of items deleted. |
int |
invalidateByPrefix(java.lang.String prefix)
Invalidate all values that start with the given key prefix, returning number deleted. |
java.util.Set<java.lang.String> |
keys()
Returns all current keys. |
java.util.List<T> |
lruValues()
Returns values in LRU order. |
void |
put(java.lang.String key,
T value)
Store a value in the cache. |
int |
size()
Return current size of list. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IndexedLRUCache(int capacity,
CacheResourceManager<T> resourceManager)
capacity - Maximum capacity of the cache, after which nodes are
removed in LRU orderresourceManager - Name of the cache manager| Method Detail |
|---|
public int size()
public void put(java.lang.String key,
T value)
public T get(java.lang.String key)
public java.util.Set<java.lang.String> keys()
public java.util.List<T> lruValues()
public int invalidateAll()
public int invalidateByPrefix(java.lang.String prefix)
public int invalidate(java.lang.String key)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||