A generic class to represent the cache related infomation of a cached object (Cacheable).
The relationship between isValid and settingIdentity can be explain by the
following life cycle of a cached item.
Stage 1 2 3
----------------------
isValid F T T
settingIdentity X T F
In Stage 1, the CachedItem is created but it is invalid and has an entry
that is just a holder object with no identity.
In Stage 2, the identity has been set and the item is being created or
being faulted into the cache.
In Stage 3, the item found in the CachedItem entry
Remove is set if this item is being removed out of existance, not just
being evicted from the cache. When the last referece to it release it from
the cache, it will be removed.
RecentlyUsed is set whenever this item is accessed (via a keep() call).
It is reset by the clockHand as it sweeps around the cache looking for
victims to evict.
MT - must be MT-safe and work with cache manager. Every method that
access (set or get) instance variables is synchronized on the cached item
object. The following method waits so it should not be called by the cache
manager inside a sync block: clean(), waitFor(), create(), remove().
(RESOLVE: need to move these from the cache manager to here)
See Also: org.apache.derby.impl.services.cache See Also: Cacheable |