|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectorg.exist.storage.DefaultCacheManager
public class DefaultCacheManager
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 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 | |
|---|---|
DefaultCacheManager(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 String PROPERTY_CACHE_SIZE
| Constructor Detail |
|---|
public DefaultCacheManager(Configuration config)
| Method Detail |
|---|
public void registerCache(Cache cache)
CacheManager
registerCache in interface CacheManagerpublic void deregisterCache(Cache cache)
deregisterCache in interface CacheManagerpublic int requestMem(Cache cache)
CacheManagerCache.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().
requestMem in interface CacheManagerpublic 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.
checkCaches in interface CacheManagerpublic void checkDistribution()
CacheManager
checkDistribution in interface CacheManagerpublic int getDefaultInitialSize()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||