|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.jackrabbit.core.state.ItemStateReferenceCache
ItemStateReferenceCache
internally consists of 2 components:
ItemStateReferenceMap serving as the primary (or main)
cache; it holds weak references to ItemState
instances. This
ItemStateCache
implementation directly represents the
contents of the primary cache, i.e. isCached(ItemId)
,
retrieve(ItemId)
}, size()
etc. only refer to the contents
of the primary cache.
ItemStateCache
implementing a custom eviction policy and
serving as the secondary (or auxiliary) cache; entries that are automatically
flusehd from this secondary cache through its eviction policy (LRU, etc.)
will be indirectly flushed from the primary (reference) cache by the garbage
collector if they are thus rendered weakly reachable.
Constructor Summary | |
ItemStateReferenceCache()
Creates a new ItemStateReferenceCache that uses a
LRUItemStateCache instance as internal secondary
cache. |
|
ItemStateReferenceCache(ItemStateCache cache)
Creates a new ItemStateReferenceCache that uses the
specified ItemStateCache instance as internal secondary
cache. |
Method Summary | |
void |
cache(ItemState state)
Stores the specified ItemState object in the map
using its ItemId as the key. |
void |
dump(PrintStream ps)
Dumps the state of this instance in a human readable format for diagnostic purposes. |
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. |
Set |
keySet()
Returns an unmodifiable set view of the keys (i.e. ItemId
objects) of the cached 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 . |
int |
size()
Returns the number of entries in this cache. |
Collection |
values()
Returns an unmodifiable collection view of the values (i.e. ItemState objects) contained in this cache. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ItemStateReferenceCache()
ItemStateReferenceCache
that uses a
LRUItemStateCache
instance as internal secondary
cache.
public ItemStateReferenceCache(ItemStateCache cache)
ItemStateReferenceCache
that uses the
specified ItemStateCache
instance as internal secondary
cache.
cache
- secondary cache implementing a custom eviction policyMethod Detail |
public boolean isCached(ItemId id)
true
if this cache contains an ItemState
object with the specified id
.
isCached
in interface ItemStateCache
id
- 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 ItemStateCache
id
- the id of the ItemState
object to be returned.
ItemState
object with the specified
id
or or null
if no entry exists
with that id
public void cache(ItemState state)
ItemState
object in the map
using its ItemId
as the key.
cache
in interface ItemStateCache
state
- 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 ItemStateCache
id
- the id of the ItemState
object which should be
removed from this cache.public void evictAll()
evictAll
in interface ItemStateCache
public boolean isEmpty()
true
if this cache contains no entries.
isEmpty
in interface ItemStateCache
true
if this cache contains no entries.public int size()
size
in interface ItemStateCache
public Set keySet()
ItemId
objects) of the cached entries.
keySet
in interface ItemStateCache
public Collection values()
ItemState
objects) contained in this cache.
values
in interface ItemStateCache
public void dump(PrintStream ps)
dump
in interface Dumpable
ps
- stream to dump state to
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |