org.exist.storage
Class CollectionCacheManager

java.lang.Object
  extended by org.exist.storage.CollectionCacheManager
All Implemented Interfaces:
CacheManager

public class CollectionCacheManager
extends Object
implements CacheManager


Field Summary
static String CACHE_SIZE_ATTRIBUTE
           
static String PROPERTY_CACHE_SIZE
           
 
Fields inherited from interface org.exist.storage.CacheManager
BTREE_CACHE, DATA_CACHE
 
Constructor Summary
CollectionCacheManager(Configuration config, CollectionCache cache)
           
 
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)
           
 long getCurrentSize()
           
 long getMaxSingle()
           
 long getMaxTotal()
           
 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

CACHE_SIZE_ATTRIBUTE

public static final String CACHE_SIZE_ATTRIBUTE
See Also:
Constant Field Values

PROPERTY_CACHE_SIZE

public static final String PROPERTY_CACHE_SIZE
See Also:
Constant Field Values
Constructor Detail

CollectionCacheManager

public CollectionCacheManager(Configuration config,
                              CollectionCache cache)
Method Detail

registerCache

public void registerCache(Cache cache)
Description copied from interface: CacheManager
Register a cache, i.e. put it under control of the cache manager.

Specified by:
registerCache in interface CacheManager

deregisterCache

public void deregisterCache(Cache cache)
Specified by:
deregisterCache in interface CacheManager

requestMem

public int requestMem(Cache cache)
Description copied from interface: CacheManager
Called by a cache if it wants to grow. The cache manager will either deny the request, for example, if there are no spare pages left, or calculate a new cache size and call the cache's 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().

Specified by:
requestMem in interface CacheManager
Returns:
new cache size, or -1 if no free pages available.

checkCaches

public void checkCaches()
Description copied from interface: CacheManager
Called from the global major sync event to check if caches can be shrinked. If shrinked, the cache will be reset to the default initial cache size.

Specified by:
checkCaches in interface CacheManager

checkDistribution

public void checkDistribution()
Description copied from interface: CacheManager
Called from the global minor sync event to check if a smaller cache wants to be resized. If a huge cache is availabe, the method might decide to shrink this cache by a certain amount to make room for the smaller cache to grow.

Specified by:
checkDistribution in interface CacheManager

getMaxTotal

public long getMaxTotal()
Specified by:
getMaxTotal in interface CacheManager

getMaxSingle

public long getMaxSingle()
Specified by:
getMaxSingle in interface CacheManager

getCurrentSize

public long getCurrentSize()
Specified by:
getCurrentSize in interface CacheManager


Copyright (C) Wolfgang Meier. All rights reserved.