org.modeshape.graph.connector.base.cache
Class InMemoryNodeCache.MapCachePolicy<NodeType extends MapNode>

java.lang.Object
  extended by org.modeshape.graph.connector.base.cache.InMemoryNodeCache.MapCachePolicy<NodeType>
Type Parameters:
NodeType - the node type that is being cached
All Implemented Interfaces:
Serializable, CachePolicy, NodeCachePolicy<UUID,NodeType>
Enclosing class:
InMemoryNodeCache<KeyType,NodeType extends Node>

public static class InMemoryNodeCache.MapCachePolicy<NodeType extends MapNode>
extends Object
implements NodeCachePolicy<UUID,NodeType>

Path cache policy implementation that caches all nodes in an in-memory cache.

As a result, this cache policy may not be safe for use with some large repositories as it does not attempt to limit cache attempts based on the size of the node or the current size of the cache.

See Also:
Serialized Form

Constructor Summary
InMemoryNodeCache.MapCachePolicy()
           
InMemoryNodeCache.MapCachePolicy(long timeToLiveInSeconds)
           
 
Method Summary
 long getTimeToLive()
          Get the system time in milliseconds before which the node data remains valid.
 InMemoryNodeCache.MapCache<NodeType> newCache()
          Return a new cache instance that uses this policy.
 void setTimeToLive(long timeToLiveInSeconds)
           
 boolean shouldCache(NodeType node)
          Indicates whether the node should be cached .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InMemoryNodeCache.MapCachePolicy

public InMemoryNodeCache.MapCachePolicy()

InMemoryNodeCache.MapCachePolicy

public InMemoryNodeCache.MapCachePolicy(long timeToLiveInSeconds)
Method Detail

shouldCache

public boolean shouldCache(NodeType node)
Description copied from interface: NodeCachePolicy
Indicates whether the node should be cached .

Specified by:
shouldCache in interface NodeCachePolicy<UUID,NodeType extends MapNode>
Parameters:
node -
Returns:
true for all nodes
See Also:
NodeCachePolicy.shouldCache(Node)

getTimeToLive

public long getTimeToLive()
Description copied from interface: CachePolicy
Get the system time in milliseconds before which the node data remains valid.

Specified by:
getTimeToLive in interface CachePolicy
Returns:
the number of milliseconds that the cached data should be used before consulting the original source.

setTimeToLive

public void setTimeToLive(long timeToLiveInSeconds)

newCache

public InMemoryNodeCache.MapCache<NodeType> newCache()
Description copied from interface: NodeCachePolicy
Return a new cache instance that uses this policy.

Specified by:
newCache in interface NodeCachePolicy<UUID,NodeType extends MapNode>
Returns:
the cache class


Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.