|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jackrabbit.core.state.MLRUItemStateCache
public class MLRUItemStateCache
An ItemStateCache implementation that internally uses a
LinkedMap to maintain a cache of ItemState objects. The
cache uses a rough estimate of the memory consumption of the cached item
states for calculating the maximum number of entries. The oldest entries
are flushed once the cache size has exceeded a certain limit.
| Field Summary | |
|---|---|
static int |
DEFAULT_MAX_MEM
default maximum memory to use |
| Constructor Summary | |
|---|---|
MLRUItemStateCache(CacheManager cacheMgr)
|
|
| Method Summary | |
|---|---|
void |
cache(ItemState state)
Stores the specified ItemState object in the map
using its ItemId as the key. |
void |
dispose()
Informs the cache that it is no longer in use. |
void |
evict(ItemId id)
Removes the ItemState object with the specified id from
this cache if it is present. |
void |
evictAll()
Clears all entries from this cache. |
boolean |
isCached(ItemId id)
Returns true if this cache contains an ItemState
object with the specified id. |
boolean |
isEmpty()
Returns true if this cache contains no entries. |
ItemState |
retrieve(ItemId id)
Returns the ItemState object with the specified
id if it is present or null if no entry exists
with that id. |
ItemState[] |
retrieveAll()
Returns all the cached item states. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_MAX_MEM
| Constructor Detail |
|---|
public MLRUItemStateCache(CacheManager cacheMgr)
| Method Detail |
|---|
public boolean isCached(ItemId id)
true if this cache contains an ItemState
object with the specified id.
isCached in interface ItemStateCacheid - id of ItemState object whose presence should be
tested.
true if there's a corresponding cache entry,
otherwise false.public ItemState retrieve(ItemId id)
ItemState object with the specified
id if it is present or null if no entry exists
with that id.
retrieve in interface ItemStateCacheid - the id of the ItemState object to be returned.
ItemState object with the specified
id or or null if no entry exists
with that idpublic ItemState[] retrieveAll()
retrieveAll in interface ItemStateCachepublic void cache(ItemState state)
ItemState object in the map
using its ItemId as the key.
cache in interface ItemStateCachestate - the ItemState object to cachepublic void evict(ItemId id)
ItemState object with the specified id from
this cache if it is present.
evict in interface ItemStateCacheid - the id of the ItemState object which should be
removed from this cache.public void evictAll()
evictAll in interface ItemStateCachepublic boolean isEmpty()
true if this cache contains no entries.
isEmpty in interface ItemStateCachetrue if this cache contains no entries.public void dispose()
dispose in interface ItemStateCache
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||