|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.gjt.rec.cache.MapCache
MapCache is an implementation of the Cache interface that uses
a Map to store its elements. Elements can be either strongly or weakly
referred to. If strong references are used, elements put in this cache
cannot be finalized until their entries in this cache have been invalidated.
Cache,
CacheElementSource| Nested Class Summary | |
static class |
MapCache.MapType
|
| Field Summary | |
static String |
REVISION
|
| Constructor Summary | |
MapCache()
Constructs a MapCache that refers to its elements using weak references. |
|
MapCache(CacheElementSource src)
Constructs a MapCache that refers to its elements using weak references. |
|
MapCache(MapCache.MapType type)
Constructs a MapCache that refers to its elements in a particular manner. |
|
MapCache(MapCache.MapType type,
CacheElementSource src)
Constructs a MapCache that refers to its elements in a particular manner. |
|
| Method Summary | |
int |
elementCount()
|
int |
hitCount()
|
void |
invalidate(Object id)
Invalidates the entry in this cache with a particular id. |
void |
invalidateAll()
Invalidates all entries in this cache. |
Object |
lookup(Object id)
Tries to find an element with a particular id in this cache. |
void |
put(Object id,
Object element)
Puts a particular element in this cache associated with a particular id. |
int |
requestCount()
|
void |
resetStatistics()
Resets the cache performance statistics to the values as they were when the cache was created. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final String REVISION
| Constructor Detail |
public MapCache()
public MapCache(MapCache.MapType type)
type - if this argument is MapCache.MapType.WEAK,
this cache will refer to its elements using weak
references. if the argument is
MapCache.MapType.STRONG, strong references
will be used instead.public MapCache(CacheElementSource src)
src - the element source from which the cache will obtain its
elements in the event of a cache miss.
public MapCache(MapCache.MapType type,
CacheElementSource src)
type - if this argument is MapCache.MapType.WEAK,
this cache will refer to its elements using weak
references. if the argument is
MapCache.MapType.STRONG, strong references
will be used instead.src - the element source from which the cache will obtain its
elements in the event of a cache miss.| Method Detail |
public Object lookup(Object id)
Cache
lookup in interface Cacheid - the id of the desired element.
public void put(Object id,
Object element)
Cachelookup(Object) method.
put in interface Cacheid - the id associated with the supplied element.element - the element to store in the cache.public void invalidate(Object id)
Cache
invalidate in interface Cacheid - the id corresponding to the element to invalidate.public void invalidateAll()
Cache
invalidateAll in interface Cachepublic int elementCount()
elementCount in interface Cachepublic int requestCount()
requestCount in interface Cachepublic int hitCount()
hitCount in interface Cachepublic void resetStatistics()
Cache
resetStatistics in interface Cachepublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||