|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.ontopia.utils.CachedIndex
public class CachedIndex
INTERNAL: A LookupIndexIF which uses another, slower, LookupIndexIF as a fallback and caches the values attached to the most commonly requested keys using an LRU strategy. There is a maximum number of keys that can be stored in the index and the index will automatically prune the less-used keys to avoid the index growing above this maximum size.
Constructor Summary | |
---|---|
CachedIndex(LookupIndexIF fallback)
Creates an index with the given fallback and default settings. |
|
CachedIndex(LookupIndexIF fallback,
boolean nulls)
Creates an index with the given fallback, default settings and the specified nulls setting. |
|
CachedIndex(LookupIndexIF fallback,
int max,
int size,
boolean nulls)
Creates an index with the given fallback and settings. |
Method Summary | |
---|---|
java.lang.Object |
get(java.lang.Object key)
|
int |
getKeyNumber()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
java.lang.Object |
remove(java.lang.Object key)
|
void |
writeReport()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CachedIndex(LookupIndexIF fallback)
public CachedIndex(LookupIndexIF fallback, boolean nulls)
public CachedIndex(LookupIndexIF fallback, int max, int size, boolean nulls)
fallback
- The index to ask if the value is not found in the cache.max
- The max number of keys to store in the cache (default: 10000).size
- The initial size of the cache.nulls
- Store null values retrieved from fallback.Method Detail |
---|
public java.lang.Object get(java.lang.Object key)
get
in interface LookupIndexIF
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface LookupIndexIF
public java.lang.Object remove(java.lang.Object key)
remove
in interface LookupIndexIF
public int getKeyNumber()
public void writeReport()
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |