|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.graph.connector.base.cache.InMemoryNodeCache<KeyType,NodeType>
KeyType
- the key for the cache entries, normally the natural unique identifier for the nodeNodeType
- the node type that is being cached@ThreadSafe public abstract class InMemoryNodeCache<KeyType,NodeType extends Node>
Implementation of NodeCache
that stores all nodes in-memory.
Nested Class Summary | |
---|---|
static class |
InMemoryNodeCache.MapCache<N extends MapNode>
|
static class |
InMemoryNodeCache.MapCachePolicy<NodeType extends MapNode>
Path cache policy implementation that caches all nodes in an in-memory cache. |
static class |
InMemoryNodeCache.PathCache
|
static class |
InMemoryNodeCache.PathCachePolicy
|
Field Summary | |
---|---|
protected ConcurrentMap<KeyType,org.modeshape.graph.connector.base.cache.InMemoryNodeCache.CacheEntry> |
entriesByKey
|
protected NodeCachePolicy<KeyType,NodeType> |
policy
|
Constructor Summary | |
---|---|
InMemoryNodeCache(NodeCachePolicy<KeyType,NodeType> policy)
|
Method Summary | |
---|---|
void |
assignPolicy(NodeCachePolicy<KeyType,NodeType> policy)
Injects the cache policy into the cache |
void |
clearStatistics()
Clears all statistics for this cache |
void |
close()
Indicates that the cache is no longer in use and should relinquish any resources. |
NodeType |
get(KeyType path)
Retrieves the cached node with the given path, it it exists and is valid |
CacheStatistics |
getStatistics()
|
void |
put(KeyType key,
NodeType node)
Attempts to cache the given node. |
void |
remove(KeyType key)
Removes the node with the given key from the cache, if it is in currently in the cache. |
void |
removeAll()
Removes all nodes from the cache. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final ConcurrentMap<KeyType,org.modeshape.graph.connector.base.cache.InMemoryNodeCache.CacheEntry> entriesByKey
protected NodeCachePolicy<KeyType,NodeType extends Node> policy
Constructor Detail |
---|
public InMemoryNodeCache(NodeCachePolicy<KeyType,NodeType> policy)
Method Detail |
---|
public void assignPolicy(NodeCachePolicy<KeyType,NodeType> policy)
NodeCache
assignPolicy
in interface NodeCache<KeyType,NodeType extends Node>
policy
- the active cache policy for the repository source with which this cache is associatedpublic void clearStatistics()
NodeCache
clearStatistics
in interface NodeCache<KeyType,NodeType extends Node>
public CacheStatistics getStatistics()
getStatistics
in interface NodeCache<KeyType,NodeType extends Node>
NodeCache.clearStatistics()
;
never nullpublic NodeType get(KeyType path)
NodeCache
get
in interface NodeCache<KeyType,NodeType extends Node>
path
- the path for the node to be retrieved
public void put(KeyType key, NodeType node)
NodeCache
NodeCachePolicy.shouldCache(Node)
on the the
assigned policy
to determine if the node should be cached.
put
in interface NodeCache<KeyType,NodeType extends Node>
key
- the key for the node that is to be cached; may not be nullnode
- the node that is to be cached; may not be nullpublic void remove(KeyType key)
NodeCache
remove
in interface NodeCache<KeyType,NodeType extends Node>
key
- the key for the node that is to be removed; may not be nullpublic void removeAll()
NodeCache
removeAll
in interface NodeCache<KeyType,NodeType extends Node>
public void close()
NodeCache
close
in interface NodeCache<KeyType,NodeType extends Node>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |