|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.modeshape.graph.connector.path.cache.InMemoryWorkspaceCache
@ThreadSafe public class InMemoryWorkspaceCache
Implementation of WorkspaceCache
that stores all nodes in-memory.
Nested Class Summary | |
---|---|
static class |
InMemoryWorkspaceCache.InMemoryCachePolicy
Trivial path cache policy implementation that caches all nodes in an in-memory cache. |
Constructor Summary | |
---|---|
InMemoryWorkspaceCache()
|
Method Summary | |
---|---|
void |
clearStatistics()
Clears all statistics for this cache |
void |
close()
Indicates that the cache is no longer in use and should relinquish any resources. |
PathNode |
get(Path path)
Retrieves the cached node with the given path, it it exists and is valid |
CacheStatistics |
getStatistics()
|
void |
initialize(PathCachePolicy policy,
String workspaceName)
Injects the cache policy into the cache |
void |
invalidate(Path path)
Invalidates all nodes in the cache that have the given path or have a path that is an ancestor of the given path |
protected PathCachePolicy |
policy()
|
void |
set(PathNode node)
Attempts to cache the given node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InMemoryWorkspaceCache()
Method Detail |
---|
public void initialize(PathCachePolicy policy, String workspaceName)
WorkspaceCache
initialize
in interface WorkspaceCache
policy
- the active cache policy for the repository source with which this cache is associatedworkspaceName
- the name of the workspace that this cache is managingprotected PathCachePolicy policy()
public void clearStatistics()
WorkspaceCache
clearStatistics
in interface WorkspaceCache
public CacheStatistics getStatistics()
getStatistics
in interface WorkspaceCache
WorkspaceCache.clearStatistics()
;
never nullpublic PathNode get(Path path)
WorkspaceCache
get
in interface WorkspaceCache
path
- the path for the node to be retrieved
public void set(PathNode node)
WorkspaceCache
PathCachePolicy.shouldCache(PathNode)
on the policy
from the WorkspaceCache.initialize(PathCachePolicy, String)
method to determine if the node should be cached.
set
in interface WorkspaceCache
node
- the node that is to be cached; may not be nullpublic void invalidate(Path path)
WorkspaceCache
invalidate
in interface WorkspaceCache
path
- the root of the branch of nodes that are to be invalidated; may not be nullpublic void close()
WorkspaceCache
close
in interface WorkspaceCache
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |