org.modeshape.graph.connector.path.cache
Class InMemoryWorkspaceCache.InMemoryCachePolicy

java.lang.Object
  extended by org.modeshape.graph.connector.path.cache.InMemoryWorkspaceCache.InMemoryCachePolicy
All Implemented Interfaces:
Serializable, CachePolicy, PathCachePolicy
Enclosing class:
InMemoryWorkspaceCache

public static class InMemoryWorkspaceCache.InMemoryCachePolicy
extends Object
implements PathCachePolicy

Trivial 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
InMemoryWorkspaceCache.InMemoryCachePolicy()
           
 
Method Summary
 Class<? extends WorkspaceCache> getCacheClass()
          Return the class to be used as the cache implementation
 long getTimeToLive()
          Get the system time in milliseconds before which the node data remains valid.
 void setTimeToLive(long timeToLiveInSeconds)
           
 boolean shouldCache(PathNode 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

InMemoryWorkspaceCache.InMemoryCachePolicy

public InMemoryWorkspaceCache.InMemoryCachePolicy()
Method Detail

shouldCache

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

Specified by:
shouldCache in interface PathCachePolicy
Parameters:
node - the node that may or may not be cached; may not be null
Returns:
true for all nodes
See Also:
PathCachePolicy.shouldCache(PathNode)

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)

getCacheClass

public Class<? extends WorkspaceCache> getCacheClass()
Description copied from interface: PathCachePolicy
Return the class to be used as the cache implementation

Specified by:
getCacheClass in interface PathCachePolicy
Returns:
the cache class


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