|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.gjt.rec.cache.MapCache | +--org.gjt.rec.cache.FixedCache
FixedCache is an implementation of the Cache
interface that
uses a fixed size element store, so that the heap usage is always capped.
Cache
,
CacheElementSource
Nested Class Summary |
Nested classes inherited from class org.gjt.rec.cache.MapCache |
MapCache.MapType |
Field Summary | |
static String |
REVISION
|
Constructor Summary | |
FixedCache(int fixedSize)
Constructs a FixedCache that refers to its elements using weak references. |
|
FixedCache(int fixedSize,
CacheElementSource src)
Constructs a FixedCache that refers to its elements using weak references. |
|
FixedCache(int fixedSize,
MapCache.MapType type)
Constructs a FixedCache that refers to its elements in a particular manner. |
|
FixedCache(int fixedSize,
MapCache.MapType type,
CacheElementSource src)
Constructs a FixedCache that refers to its elements in a particular manner. |
Method Summary | |
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. |
String |
toString()
|
Methods inherited from class org.gjt.rec.cache.MapCache |
elementCount, hitCount, requestCount, resetStatistics |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.gjt.rec.cache.Cache |
elementCount, hitCount, requestCount, resetStatistics |
Field Detail |
public static final String REVISION
Constructor Detail |
public FixedCache(int fixedSize)
fixedSize
- the maximum number of elements to hold in the cache.public FixedCache(int fixedSize, MapCache.MapType type)
fixedSize
- the maximum number of elements to hold in the cache.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 FixedCache(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.public FixedCache(int fixedSize, MapCache.MapType type, CacheElementSource src)
fixedSize
- the maximum number of elements to hold in the cache.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 Cache
lookup
in class MapCache
id
- the id of the desired element.
public void put(Object id, Object element)
Cache
lookup(Object)
method.
put
in interface Cache
put
in class MapCache
id
- the id associated with the supplied element.element
- the element to store in the cache.public void invalidate(Object id)
Cache
invalidate
in interface Cache
invalidate
in class MapCache
id
- the id corresponding to the element to invalidate.public void invalidateAll()
Cache
invalidateAll
in interface Cache
invalidateAll
in class MapCache
public String toString()
toString
in class MapCache
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |