|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exist.storage.CacheManager
CacheManager maintains a global memory pool available to all page caches. All caches start with a low default setting, but CacheManager can grow individual caches until the total memory is reached. Caches can also be shrinked if their "load" remains below a given threshold between check intervals.The check interval is determined by the global sync background thread. The class computes the available memory in terms of pages.
Field Summary | |
static int |
DEFAULT_CACHE_SIZE
|
static double |
MAX_MEM_USE
The maximum fraction of the total memory that can be used by a single cache. |
static double |
MIN_SHRINK_FACTOR
The minimum size a cache needs to have to be considered for shrinking, defined in terms of a fraction of the overall memory. |
static java.lang.String |
PROPERTY_CACHE_SIZE
|
static double |
SHRINK_FACTOR
The amount by which a large cache will be shrinked if other caches request a resize. |
static int |
SHRINK_THRESHOLD
The minimum number of pages that must be read from a cache between check intervals to be not considered for shrinking. |
Constructor Summary | |
CacheManager(Configuration config)
|
Method Summary | |
void |
checkCaches()
Called from the global major sync event to check if caches can be shrinked. |
void |
checkDistribution()
Called from the global minor sync event to check if a smaller cache wants to be resized. |
void |
deregisterCache(Cache cache)
|
int |
getDefaultInitialSize()
Returns the default initial size for all caches. |
void |
registerCache(Cache cache)
Register a cache, i.e. |
int |
requestMem(Cache cache)
Called by a cache if it wants to grow. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final double MAX_MEM_USE
public static final double MIN_SHRINK_FACTOR
public static final double SHRINK_FACTOR
public static final int SHRINK_THRESHOLD
public static int DEFAULT_CACHE_SIZE
public static final java.lang.String PROPERTY_CACHE_SIZE
Constructor Detail |
public CacheManager(Configuration config)
Method Detail |
public void registerCache(Cache cache)
cache
- public void deregisterCache(Cache cache)
public int requestMem(Cache cache)
Cache.resize(int)
method to resize the cache. The amount
of pages by which the cache will grow is determined by the cache's
growthFactor: Cache.getGrowthFactor()
.
cache
-
public void checkCaches()
MIN_SHRINK_FACTOR
and its load needs to be lower than SHRINK_THRESHOLD
.
If shrinked, the cache will be reset to the default initial cache size.
public void checkDistribution()
public int getDefaultInitialSize()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |