|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface TreeCache<K,V>
This is a tree-like facade around a Cache allowing for efficient tree-style access to cached data.
Cache interface directly as it is simpler.
The tree API assumes that a collection of Nodes, organized in a tree structure underneath a root node,
contains key/value attributes of data.
Any locking happens on a node-level granularity, which means that all attributes on a node are atomic and in terms of
locking, is coarse grained. At the same time, replication is fine grained, and only modified attributes in a Node
are replicated.
Obtaining a TreeCache is done using the TreeCacheFactory.
Cache cache = new DefaultCacheFactory().getCache(); TreeCacheFactory tcf = new TreeCacheFactory(); TreeCache tree = tcf.createTreeCache(cache);
Node| Method Summary | |
|---|---|
void |
clearData(Fqn fqn)
Removes the keys and properties from a named node. |
void |
clearData(Fqn fqn,
Flag... flags)
|
void |
clearData(String fqn)
Convenience method that takes in a String represenation of the Fqn. |
void |
clearData(String fqn,
Flag... flags)
|
boolean |
exists(Fqn fqn)
Tests if an Fqn exists. |
boolean |
exists(Fqn fqn,
Flag... flags)
|
boolean |
exists(String fqn)
Tests if an Fqn exists. |
boolean |
exists(String fqn,
Flag... flags)
|
V |
get(Fqn fqn,
K key)
Convenience method that allows for direct access to the data in a Node. |
V |
get(Fqn fqn,
K key,
Flag... flags)
|
V |
get(String fqn,
K key)
Convenience method that takes a string representation of an Fqn. |
V |
get(String fqn,
K key,
Flag... flags)
|
Cache<?,?> |
getCache()
|
Map<K,V> |
getData(Fqn fqn)
Retrieves a defensively copied data map of the underlying node. |
Map<K,V> |
getData(Fqn fqn,
Flag... flags)
|
Set<K> |
getKeys(Fqn fqn)
Returns a set of attribute keys for the Fqn. |
Set<K> |
getKeys(Fqn fqn,
Flag... flags)
|
Set<K> |
getKeys(String fqn)
Convenience method that takes in a String represenation of the Fqn. |
Set<K> |
getKeys(String fqn,
Flag... flags)
|
Node<K,V> |
getNode(Fqn fqn)
A convenience method to retrieve a node directly from the cache. |
Node<K,V> |
getNode(Fqn fqn,
Flag... flags)
|
Node<K,V> |
getNode(String fqn)
Convenience method that takes a string representation of an Fqn. |
Node<K,V> |
getNode(String fqn,
Flag... flags)
|
Node<K,V> |
getRoot()
Returns the root node of this cache. |
Node<K,V> |
getRoot(Flag... flags)
|
void |
move(Fqn nodeToMove,
Fqn newParent)
Moves a part of the cache to a different subtree. |
void |
move(Fqn nodeToMove,
Fqn newParent,
Flag... flags)
|
void |
move(String nodeToMove,
String newParent)
Convenience method that takes in string representations of Fqns. |
void |
move(String nodeToMove,
String newParent,
Flag... flags)
|
V |
put(Fqn fqn,
K key,
V value)
Associates the specified value with the specified key for a Node in this cache. |
V |
put(Fqn fqn,
K key,
V value,
Flag... flags)
|
void |
put(Fqn fqn,
Map<? extends K,? extends V> data)
Copies all of the mappings from the specified map to a Node. |
void |
put(Fqn fqn,
Map<? extends K,? extends V> data,
Flag... flags)
|
V |
put(String fqn,
K key,
V value)
Convenience method that takes a string representation of an Fqn. |
V |
put(String fqn,
K key,
V value,
Flag... flags)
|
void |
put(String fqn,
Map<? extends K,? extends V> data)
Convenience method that takes a string representation of an Fqn. |
void |
put(String fqn,
Map<? extends K,? extends V> data,
Flag... flags)
|
V |
remove(Fqn fqn,
K key)
Removes the mapping for this key from a Node. |
V |
remove(Fqn fqn,
K key,
Flag... flags)
|
V |
remove(String fqn,
K key)
Convenience method that takes a string representation of an Fqn. |
V |
remove(String fqn,
K key,
Flag... flags)
|
boolean |
removeNode(Fqn fqn)
Removes a Node indicated by absolute Fqn. |
boolean |
removeNode(Fqn fqn,
Flag... flags)
|
boolean |
removeNode(String fqn)
Convenience method that takes a string representation of an Fqn. |
boolean |
removeNode(String fqn,
Flag... flags)
|
| Methods inherited from interface org.infinispan.lifecycle.Lifecycle |
|---|
start, stop |
| Method Detail |
|---|
Node<K,V> getRoot()
Node<K,V> getRoot(Flag... flags)
V put(Fqn fqn,
K key,
V value)
Node in this cache. If the Node
previously contained a mapping for this key, the old value is replaced by the specified value.
fqn - absolute Fqn to the Node to be accessed.key - key with which the specified value is to be associated.value - value to be associated with the specified key.
null if there was no mapping for key. A
null return can also indicate that the Node previously associated null with the
specified key, if the implementation supports null values.
IllegalStateException - if the cache is not in a started state.
V put(Fqn fqn,
K key,
V value,
Flag... flags)
V put(String fqn,
K key,
V value)
put(Fqn, Object,
Object)
fqn - String representation of the Fqnkey - key with which the specified value is to be associated.value - value to be associated with the specified key.
null if there was no mapping for key. A
null return can also indicate that the Node previously associated null with the
specified key, if the implementation supports null values.
IllegalStateException - if the cache is not in a started state
V put(String fqn,
K key,
V value,
Flag... flags)
void put(Fqn fqn,
Map<? extends K,? extends V> data)
Node.
fqn - absolute Fqn to the Node to copy the data todata - mappings to copy
IllegalStateException - if the cache is not in a started state
void put(Fqn fqn,
Map<? extends K,? extends V> data,
Flag... flags)
void put(String fqn,
Map<? extends K,? extends V> data)
put(Fqn,
java.util.Map)
fqn - String representation of the Fqndata - data map to insert
IllegalStateException - if the cache is not in a started state
void put(String fqn,
Map<? extends K,? extends V> data,
Flag... flags)
V remove(Fqn fqn,
K key)
null if the Node contained no mapping for this key.
fqn - absolute Fqn to the Node to be accessed.key - key whose mapping is to be removed from the Node
IllegalStateException - if the cache is not in a started state
V remove(Fqn fqn,
K key,
Flag... flags)
V remove(String fqn,
K key)
remove(Fqn,
Object)
fqn - string representation of the Fqn to retrievekey - key to remove
IllegalStateException - if the cache is not in a started state
V remove(String fqn,
K key,
Flag... flags)
boolean removeNode(Fqn fqn)
Node indicated by absolute Fqn.
fqn - Node to remove
IllegalStateException - if the cache is not in a started state
boolean removeNode(Fqn fqn,
Flag... flags)
boolean removeNode(String fqn)
removeNode(Fqn)
fqn - string representation of the Fqn to retrieve
IllegalStateException - if the cache is not in a started state
boolean removeNode(String fqn,
Flag... flags)
Node<K,V> getNode(Fqn fqn)
fqn - fqn of the node to retrieve
IllegalStateException - if the cache is not in a started state
Node<K,V> getNode(Fqn fqn,
Flag... flags)
Node<K,V> getNode(String fqn)
getNode(Fqn)
fqn - string representation of the Fqn to retrieve
IllegalStateException - if the cache is not in a started state
Node<K,V> getNode(String fqn,
Flag... flags)
V get(Fqn fqn,
K key)
Node.
fqn - absolute Fqn to the Node to be accessed.key - key under which value is to be retrieved.
Node denoted by specified Fqn.
IllegalStateException - if the cache is not in a started state
V get(Fqn fqn,
K key,
Flag... flags)
V get(String fqn,
K key)
get(Fqn,
Object)
fqn - string representation of the Fqn to retrievekey - key to fetch
IllegalStateException - if the cache is not in a started state
V get(String fqn,
K key,
Flag... flags)
void move(Fqn nodeToMove,
Fqn newParent)
throws NodeNotExistsException
/a/b/c
/a/b/d
/a/b/e
Fqn f1 = Fqn.fromString("/a/b/c");
Fqn f2 = Fqn.fromString("/a/b/d");
cache.move(f1, f2);
Will result in:
/a/b/d/c /a/b/eand now
Fqn f3 = Fqn.fromString("/a/b/e");
Fqn f4 = Fqn.fromString("/a");
cache.move(f3, f4);
will result in:
/a/b/d/c /a/eNo-op if the node to be moved is the root node. Note: As of 3.0.0 and when using MVCC locking, more specific behaviour is defined as follows:
nodeToMove - the Fqn of the node to move.newParent - new location under which to attach the node being moved.
NodeNotExistsException - may throw one of these if the target node does not exist or if a different thread
has moved this node elsewhere already.
IllegalStateException - if Cache.getStatus() would not return ComponentStatus.RUNNING.
void move(Fqn nodeToMove,
Fqn newParent,
Flag... flags)
throws NodeNotExistsException
NodeNotExistsException
void move(String nodeToMove,
String newParent)
throws NodeNotExistsException
move(Fqn, Fqn)
IllegalStateException - if Cache.getStatus() would not return ComponentStatus.RUNNING.
NodeNotExistsException
void move(String nodeToMove,
String newParent,
Flag... flags)
throws NodeNotExistsException
NodeNotExistsExceptionMap<K,V> getData(Fqn fqn)
fqn -
CacheException
IllegalStateException - if Cache.getStatus() would not return ComponentStatus.RUNNING.
Map<K,V> getData(Fqn fqn,
Flag... flags)
Set<K> getKeys(String fqn)
getKeys(Fqn).
Set<K> getKeys(String fqn,
Flag... flags)
Set<K> getKeys(Fqn fqn)
fqn - name of the node
IllegalStateException - if Cache.getStatus() would not return ComponentStatus.RUNNING.
Set<K> getKeys(Fqn fqn,
Flag... flags)
void clearData(String fqn)
clearData(Fqn).
IllegalStateException - if Cache.getStatus() would not return ComponentStatus.RUNNING.
void clearData(String fqn,
Flag... flags)
void clearData(Fqn fqn)
fqn - name of the node
IllegalStateException - if Cache.getStatus() would not return ComponentStatus.RUNNING.
void clearData(Fqn fqn,
Flag... flags)
Cache<?,?> getCache()
boolean exists(String fqn)
exists(Fqn)
fqn - string representation of an Fqn
boolean exists(String fqn,
Flag... flags)
boolean exists(Fqn fqn)
fqn - Fqn to test
boolean exists(Fqn fqn,
Flag... flags)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||