|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.pom.RefreshCache
A fixed size, most recently used object cache.
The caches size is set at construction, and only the most recently used
entries are maintained. Each get or put operation makes that entry the
most recently used. When putting new entries, if the cache is full, the
least recently used entry is aged out of the cache.
Supported API: false
Extendable: false
Nested Class Summary | |
(package private) class |
RefreshCache.RefreshCacheListener
|
Field Summary | |
protected int |
agedOut
|
protected int |
cacheSize
|
protected int |
count
|
protected int[] |
hashCodes
|
protected int |
hits
|
protected Object[] |
keys
|
private int |
leastRecentlyUsed
|
private RefreshCache.RefreshCacheListener |
listener
|
protected int |
misses
|
private int |
mostRecentlyUsed
|
private short[] |
newer
|
private short[] |
next
|
private short[] |
older
|
private short[] |
prev
|
private static String |
RESOURCE
|
protected int |
tableSize
|
protected Object[] |
values
|
private static String |
versionID
|
Constructor Summary | |
RefreshCache(int size)
Construct a new fixed-size, most-recently-used cache. |
Method Summary | |
void |
clear()
Clears the cache. |
boolean |
containskey(ObjectIdentifier key)
check if the specified key exists Supported API: true |
Enumeration |
entries()
Returns an Enumeration of the entries in the cache. |
protected int |
find(Object key)
Protected method that finds existing entry. |
Object |
get(ObjectIdentifier key)
Get an entry from the cache. |
Object[] |
getKeys()
|
protected POMOperationListener |
getPOMOperationListener()
|
protected int |
link(Object key)
Protected method that finds slot for an existing or new entry. |
protected void |
overflow(Object key,
Object value)
Called when an entry is being aged out of the cache. |
protected void |
print()
|
void |
put(ObjectIdentifier key,
Persistable value)
Put an entry in the cache. |
protected void |
registerRefreshCacheListener()
|
void |
remove(ObjectIdentifier key)
Remove an entry from the cache. |
String |
toString()
Returns string representation of the cache. |
protected void |
touch(int index)
Protected method to update age links to make the given entry be the most recently used. |
private void |
unlink(int index)
Protected method to unlink an entry from the cache. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final String versionID
private static final String RESOURCE
protected int cacheSize
protected int tableSize
protected int count
protected Object[] keys
protected Object[] values
protected int[] hashCodes
protected int hits
protected int misses
protected int agedOut
private int mostRecentlyUsed
private int leastRecentlyUsed
private short[] newer
private short[] older
private short[] next
private short[] prev
private RefreshCache.RefreshCacheListener listener
Constructor Detail |
public RefreshCache(int size)
size
- the maximum number of entries stored in the cache.Method Detail |
public boolean containskey(ObjectIdentifier key)
key
- the entry key
public Object get(ObjectIdentifier key)
key
- the entry key
public void put(ObjectIdentifier key, Persistable value)
key
- the entry keyvalue
- the value to associate with the given keypublic void remove(ObjectIdentifier key)
key
- the entry keypublic void clear()
protected int find(Object key)
key
- the entry key
protected int link(Object key)
key
- the entry key
protected void touch(int index)
index
- the index of the entryprivate void unlink(int index)
index
- the index of the entrypublic Enumeration entries()
Enumeration
of the entries in the cache.
public String toString()
protected void overflow(Object key, Object value)
key
- the entry keyvalue
- the entry valueprotected void print()
public Object[] getKeys()
protected POMOperationListener getPOMOperationListener()
protected void registerRefreshCacheListener() throws PersistenceException
PersistenceException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |