|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.gjt.rec.cache.TagCache
TagCache is an implementation of the Cache interface that
offers cacheing for the fewest bytecode instructions at the cost of the hit
ratio. A TagCache uses a fixed size element store, so that the heap usage
is always capped. This implementation uses only strong references.
Cache,
CacheElementSource| Field Summary | |
static String |
REVISION
|
| Constructor Summary | |
TagCache(int fixedSize)
Constructs a TagCache. |
|
TagCache(int fixedSize,
CacheElementSource src)
Constructs a TagCache that will be obtain its elements from the supplied CacheElementSource. |
|
| 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 TagCache(int fixedSize)
fixedSize - the maximum number of elements to hold in the cache.
public TagCache(int fixedSize,
CacheElementSource src)
fixedSize - the maximum number of elements to hold in the cache.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 | |||||||||