| java.lang.Object com.hp.hpl.jena.graph.TripleCache
TripleCache | public class TripleCache (Code) | | TripleCache caches triples according to their SPO members, to reduce store
turnover at the expense of some added computation. The cache is implemented
as an array indexed by the (reduced) hashCode of the triples it stores.
Each slot is treated independantly and only the most recent stored triple is
remembered - there is no weighting, LRU, or anything like that.
author: kers |
Field Summary | |
public static int | SIZE The size of the cache array. |
Method Summary | |
public Triple | get(Node s, Node p, Node o) Answer any triple in the cache with subject s , predicate
p , and object o , or null if
no such triple exists.
The implementation looks in the slot with the same reduced hashCode as
the SPO combination would have. | public Triple | put(Triple t) Cache the triple t by storing it in the slot with the its reduced
hash. |
SIZE | public static int SIZE(Code) | | The size of the cache array. 1000 gets 80% hits when running the Jena
test suite and all the slots get used. 10000 gets about 83% and *almost* all
the slots get used. Absent real performance indicators, 1000 will do for
now.
|
get | public Triple get(Node s, Node p, Node o)(Code) | | Answer any triple in the cache with subject s , predicate
p , and object o , or null if
no such triple exists.
The implementation looks in the slot with the same reduced hashCode as
the SPO combination would have. If the triple there has the same SPO,
it is returned; otherwise null is returned.
|
put | public Triple put(Triple t)(Code) | | Cache the triple t by storing it in the slot with the its reduced
hash. Any triple already in that slot vanishes. Answer that triple.
|
|
|