|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
KeyType
- the key for the cache entries, normally the natural unique identifier for the nodeNodeType
- the node type that is being cached@ThreadSafe public interface NodeCache<KeyType,NodeType extends Node>
The basic contract for a workspace-level cache of paths to the nodes stored at that path.
Implementations must provide a no-argument constructor in order to be instantiated by NodeCachePolicy
. After
instantiation, the assignPolicy(NodeCachePolicy)
method will be called to inject the cache policy into the
implementation.
Implementations must be thread-safe.
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. |
Method Detail |
---|
void assignPolicy(NodeCachePolicy<KeyType,NodeType> policy)
policy
- the active cache policy for the repository source with which this cache is associated
IllegalStateException
- if this method is called on a cache that has already been initialized.void clearStatistics()
CacheStatistics getStatistics()
clearStatistics()
;
never nullNodeType get(KeyType path)
path
- the path for the node to be retrieved
void put(KeyType key, NodeType node)
NodeCachePolicy.shouldCache(Node)
on the the
assigned policy
to determine if the node should be cached.
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 nullvoid remove(KeyType key)
key
- the key for the node that is to be removed; may not be nullvoid removeAll()
void close()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |