| java.lang.Object com.hp.hpl.jena.graph.NodeCache
NodeCache | public class NodeCache (Code) | | A NodeCache caches nodes according to their labels, to reduce store turnover
at the expense of some additional computation. The cache is represented as an
array indexed by the reduced hashcode of the labels of the nodes it contains.
Only the most recent node with any given reduced hash is kept. This tactic
means that we don't need to have any explicit cache-clearing code in normal
oepration.
author: kers |
Field Summary | |
final protected static int | SIZE The defined size of the cache; 5000 is mostly guesswork. | final protected static boolean | counting | final protected Node[] | nodes The cache nodes, indexed by their label's reduced hash. |
Method Summary | |
public void | clear() Wipe the cache of all entries. | public Node | get(Object label) Answer the node with the given label in the cache, or
null if there isn't one. | public void | put(Object label, Node cached) Record in the cache the designated Node, using the given label (which must
be .equals() to the Node's label). | public int | size() |
SIZE | final protected static int SIZE(Code) | | The defined size of the cache; 5000 is mostly guesswork. (It didn't *quite*
fill up when running the tests and had about an 85% hit-rate).
|
counting | final protected static boolean counting(Code) | | |
nodes | final protected Node[] nodes(Code) | | The cache nodes, indexed by their label's reduced hash.
|
clear | public void clear()(Code) | | Wipe the cache of all entries.
|
get | public Node get(Object label)(Code) | | Answer the node with the given label in the cache, or
null if there isn't one. Selects the slot in the cache by the
reduced hash of the label, and confirms that the Node is the right one using
.equals() on this label and that node's label.
|
put | public void put(Object label, Node cached)(Code) | | Record in the cache the designated Node, using the given label (which must
be .equals() to the Node's label).
|
|
|