|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.partnersoft.gadgets.HashedCache
public abstract class HashedCache
A fixed-size caching implementation based on a hashed index.
| Field Summary | |
|---|---|
static int |
DEFAULTSIZE
|
| Constructor Summary | |
|---|---|
HashedCache()
Create a hashed cache of the default size, 42. |
|
HashedCache(int size)
Create a hashed cache of the desired size. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears all items from the cache, so that they must be reloaded. |
void |
finalize(java.lang.Object flushCandidate)
Optional override for subclasses - called before flushing an object. |
java.lang.Object |
getCached(java.lang.Object index)
|
int |
getCacheSize()
|
abstract java.lang.Object |
getUncached(java.lang.Object index)
Subclasses must implement this - it does the "real fetch" of the object, uncached, however appropriate for your use. |
boolean |
getUsingSeparateReaperThread()
If true, creates a separate thread which reaps old entries from the cache. |
boolean |
isFlushable(java.lang.Object flushCandidate)
Optional override for subclasses - tests if an object can be flushed. |
boolean |
remove(java.lang.Object index)
|
void |
setCacheSize(int newSize)
|
void |
setUsingSeparateReaperThread(boolean tizit)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULTSIZE
| Constructor Detail |
|---|
public HashedCache()
public HashedCache(int size)
| Method Detail |
|---|
public java.lang.Object getCached(java.lang.Object index)
public void finalize(java.lang.Object flushCandidate)
public boolean isFlushable(java.lang.Object flushCandidate)
public abstract java.lang.Object getUncached(java.lang.Object index)
public void clear()
public int getCacheSize()
public void setCacheSize(int newSize)
public boolean getUsingSeparateReaperThread()
public void setUsingSeparateReaperThread(boolean tizit)
public boolean remove(java.lang.Object index)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||