org.apache.jackrabbit.core.persistence.util
Class BundleCache

java.lang.Object
  extended by org.apache.jackrabbit.core.persistence.util.BundleCache

public class BundleCache
extends Object

This Class implements a simple cache for nodeprop bundles


Constructor Summary
BundleCache(long maxSize)
          Creates a new BundleCache
 
Method Summary
 void clear()
          Clears this cache and removes all bundles.
 boolean contains(NodeId id)
          Checks if the bundle with the given id is cached.
 NodePropBundle get(NodeId id)
          Returns the bundle with the given id or null if the bundle is not cached.
 long getMaxSize()
          Returns the maximum cache size in bytes.
 void put(NodePropBundle bundle)
          Puts a bunlde to the cache.
 NodePropBundle remove(NodeId id)
          Removes a bundle from this cache.
 void setMaxSize(long maxSize)
          Sets the maximum cache size in bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BundleCache

public BundleCache(long maxSize)
Creates a new BundleCache

Parameters:
maxSize - the maximum size of this cache in bytes.
Method Detail

getMaxSize

public long getMaxSize()
Returns the maximum cache size in bytes.

Returns:
the maximum cache size in bytes.

setMaxSize

public void setMaxSize(long maxSize)
Sets the maximum cache size in bytes.

Parameters:
maxSize - the maximum cache size in bytes.

get

public NodePropBundle get(NodeId id)
Returns the bundle with the given id or null if the bundle is not cached.

Parameters:
id - the id of the bundle
Returns:
the cached bundle or null

put

public void put(NodePropBundle bundle)
Puts a bunlde to the cache. If the new size of the cache exceeds the max size of the cache it will remove bundles from this cache until the limit is satisfied.

Parameters:
bundle - the bunlde to put to the cache

contains

public boolean contains(NodeId id)
Checks if the bundle with the given id is cached.

Parameters:
id - the id of the bundle
Returns:
true if the bundle is cached; false otherwise.

remove

public NodePropBundle remove(NodeId id)
Removes a bundle from this cache.

Parameters:
id - the id of the bunlde to remove.
Returns:
the previously cached bunlde or null of the bundle was not cached.

clear

public void clear()
Clears this cache and removes all bundles.



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