public class Cache extends Object
The cache scheme uses a doubly linked-list hashtable. The most recently accessed objects are moved to the start of the list. The end elements in the list are wiped if the cache becomes too full.
Constructor and Description |
---|
Cache() |
Cache(int max_size) |
Cache(int max_size,
int clean_percentage) |
Cache(int hash_size,
int max_size,
int clean_percentage)
The Constructors.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkClean()
This is called whenever at Object is put into the cache.
|
protected int |
clean()
Cleans away some old elements in the cache.
|
void |
clear() |
Object |
get(Object key)
If the cache contains the cell with the given key, this method will
return the object.
|
protected int |
getHashSize()
Deprecated.
|
int |
nodeCount()
Returns the number of nodes that are currently being stored in the
cache.
|
protected void |
notifyGetWalks(long total_walks,
long total_get_ops)
Notifies that some statistical information about the hash map has
updated.
|
protected void |
notifyWipingNode(Object ob)
Notifies that the given object has been wiped from the cache by the
clean up procedure.
|
void |
put(Object key,
Object ob)
Puts an Object into the cache with the given key.
|
Object |
remove(Object key)
Ensures that there is no cell with the given key in the cache.
|
void |
removeAll()
Clear the cache of all the entries.
|
protected boolean |
shouldWipeMoreNodes()
Returns true if the clean-up method that periodically cleans up the
cache, should clean up more elements from the cache.
|
public Cache(int hash_size, int max_size, int clean_percentage)
public Cache(int max_size, int clean_percentage)
public Cache(int max_size)
public Cache()
protected final int getHashSize()
protected void checkClean()
protected boolean shouldWipeMoreNodes()
protected void notifyWipingNode(Object ob)
protected void notifyGetWalks(long total_walks, long total_get_ops)
This method is called every 8192 gets.
public final int nodeCount()
public final Object get(Object key)
public final Object remove(Object key)
public void removeAll()
public void clear()
protected final int clean()
Copyright © 2015. All rights reserved.