org.apache.jackrabbit.spi.commons
Class ItemInfoCacheImpl

java.lang.Object
  extended by org.apache.jackrabbit.spi.commons.ItemInfoCacheImpl
All Implemented Interfaces:
org.apache.jackrabbit.spi.ItemInfoCache

public class ItemInfoCacheImpl
extends Object
implements org.apache.jackrabbit.spi.ItemInfoCache

This implementation of ItemInfoCache has a default size of 5000 items. Item infos are put into the cache after they have been read from the RepositoryService. If the cache is full, the oldest item is discarded. Reading items removes them from the cache. The underlying idea here is, that ItemInfos which are supplied by the RepositoryService but not immediately needed are put into the cache to avoid further round trips to RepositoryService. When they are needed later, they are read from the cache. There is no need to keep them in this cache after that point since they are present in the hierarchy from then on.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.jackrabbit.spi.ItemInfoCache
org.apache.jackrabbit.spi.ItemInfoCache.Entry<T extends org.apache.jackrabbit.spi.ItemInfo>
 
Field Summary
static int DEFAULT_CACHE_SIZE
          Default size of the cache.
 
Constructor Summary
ItemInfoCacheImpl()
          Create a new instance with the default cache size.
ItemInfoCacheImpl(int cacheSize)
          Create a new instance with a given cache size.
 
Method Summary
 void dispose()
           
 org.apache.jackrabbit.spi.ItemInfoCache.Entry<org.apache.jackrabbit.spi.NodeInfo> getNodeInfo(org.apache.jackrabbit.spi.NodeId nodeId)
          This implementation removes the item from the cache if it is present.
 org.apache.jackrabbit.spi.ItemInfoCache.Entry<org.apache.jackrabbit.spi.PropertyInfo> getPropertyInfo(org.apache.jackrabbit.spi.PropertyId propertyId)
          This implementation removes the item from the cache if it is present.
 void put(org.apache.jackrabbit.spi.ItemInfo info, long generation)
          This implementation cached the item by its id and if the id is uuid based but has no path, also by its path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CACHE_SIZE

public static final int DEFAULT_CACHE_SIZE
Default size of the cache.

See Also:
Constant Field Values
Constructor Detail

ItemInfoCacheImpl

public ItemInfoCacheImpl()
Create a new instance with the default cache size.

See Also:
DEFAULT_CACHE_SIZE

ItemInfoCacheImpl

public ItemInfoCacheImpl(int cacheSize)
Create a new instance with a given cache size.

Parameters:
cacheSize -
Method Detail

getNodeInfo

public org.apache.jackrabbit.spi.ItemInfoCache.Entry<org.apache.jackrabbit.spi.NodeInfo> getNodeInfo(org.apache.jackrabbit.spi.NodeId nodeId)
This implementation removes the item from the cache if it is present. Furthermore if the nodeId id uuid based, and no item is found by the nodeId a second lookup is done by the path.

Specified by:
getNodeInfo in interface org.apache.jackrabbit.spi.ItemInfoCache

getPropertyInfo

public org.apache.jackrabbit.spi.ItemInfoCache.Entry<org.apache.jackrabbit.spi.PropertyInfo> getPropertyInfo(org.apache.jackrabbit.spi.PropertyId propertyId)
This implementation removes the item from the cache if it is present. Furthermore if the propertyId id uuid based, and no item is found by the propertyId a second lookup is done by the path.

Specified by:
getPropertyInfo in interface org.apache.jackrabbit.spi.ItemInfoCache

put

public void put(org.apache.jackrabbit.spi.ItemInfo info,
                long generation)
This implementation cached the item by its id and if the id is uuid based but has no path, also by its path.

Specified by:
put in interface org.apache.jackrabbit.spi.ItemInfoCache

dispose

public void dispose()
Specified by:
dispose in interface org.apache.jackrabbit.spi.ItemInfoCache


Copyright © 2004-2014 The Apache Software Foundation. All Rights Reserved.