org.exist.collections
Class CollectionCache

java.lang.Object
  extended by org.exist.storage.cache.LRUCache
      extended by org.exist.collections.CollectionCache
All Implemented Interfaces:
Cache

public class CollectionCache
extends LRUCache

Global cache for Collection objects. The cache is owned by CollectionStore. It is not synchronized. Thus a lock should be obtained on the collection store before accessing the cache.

Author:
wolf

Field Summary
 
Fields inherited from interface org.exist.storage.cache.Cache
LOG
 
Constructor Summary
CollectionCache(BrokerPool pool, int blockBuffers, double growthThreshold)
           
 
Method Summary
 void add(Collection collection)
           
 void add(Collection collection, int initialRefCount)
           
 Collection get(Collection collection)
           
 Collection get(XmldbURI name)
           
 int getRealSize()
          Compute and return the in-memory size of all collections currently contained in this cache.
 void remove(Cacheable item)
          Remove an item from the cache.
 void resize(int newSize)
          Resize the cache.
 
Methods inherited from class org.exist.storage.cache.LRUCache
add, add, flush, get, get, getBuffers, getFails, getFileName, getFirst, getGrowthFactor, getHits, getLoad, getThrashing, getType, getUsedBuffers, hasDirtyItems, setCacheManager, setFileName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionCache

public CollectionCache(BrokerPool pool,
                       int blockBuffers,
                       double growthThreshold)
Method Detail

add

public void add(Collection collection)

add

public void add(Collection collection,
                int initialRefCount)

get

public Collection get(Collection collection)

get

public Collection get(XmldbURI name)

remove

public void remove(Cacheable item)
Description copied from interface: Cache
Remove an item from the cache.

Specified by:
remove in interface Cache
Overrides:
remove in class LRUCache

getRealSize

public int getRealSize()
Compute and return the in-memory size of all collections currently contained in this cache.

Returns:
in-memory size in bytes.
See Also:
CollectionCacheManager

resize

public void resize(int newSize)
Description copied from interface: Cache
Resize the cache. This method is called by the DefaultCacheManager. The newSize parameter can either be larger or smaller than the current cache size.

Specified by:
resize in interface Cache
Overrides:
resize in class LRUCache
Parameters:
newSize - the new size of the cache.


Copyright (C) Wolfgang Meier. All rights reserved.