org.exist.storage.cache
Class LRDCache
java.lang.Object
org.exist.storage.cache.GClockCache
org.exist.storage.cache.LRDCache
- All Implemented Interfaces:
- Cache
- Direct Known Subclasses:
- CollectionCache
public class LRDCache
- extends GClockCache
A cache implementation based on a Least Reference Density (LRD)
replacement policy.
The class maintains a global reference counter, containing the sum of all
references in the cache. Each object has a timestamp, which is equal to
the number of global references at the time, the object has been added to
the cache.
If the cache is full, the object with the least reference density is removed.
The reference density is computed as the ratio between the object's reference
counter and the number of references added since the object has been included
into the cache, i.e. RC(i) / (GR - TS(i)).
- Author:
- wolf
Fields inherited from interface org.exist.storage.cache.Cache |
LOG |
Constructor Summary |
LRDCache(int size,
double growthFactor,
double growthThreshold,
String type)
|
Method Summary |
void |
add(Cacheable item,
int initialRefCount)
Add the item to the cache. |
Methods inherited from class org.exist.storage.cache.GClockCache |
add, flush, get, get, getBuffers, getFails, getFileName, getGrowthFactor, getHits, getLoad, getThrashing, getType, getUsedBuffers, hasDirtyItems, remove, resize, setCacheManager, setFileName |
LRDCache
public LRDCache(int size,
double growthFactor,
double growthThreshold,
String type)
add
public void add(Cacheable item,
int initialRefCount)
- Description copied from interface:
Cache
- Add the item to the cache. If it is already in the cache,
update the references.
- Specified by:
add
in interface Cache
- Overrides:
add
in class GClockCache
initialRefCount
- the initial reference count for the item
Copyright (C) Wolfgang Meier. All rights reserved.