|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Cacheable
An interface to indicate something can be cached.
See below for the default implementation. In most cases, you can copy it and put it
into your code as the implementation of Cacheable
.
private Object _filtered = INVALID_VALUE;
public Object getCachedValue() {
return _filtered;
}
public void setCachedValue(Object value) {
_filtered = value;
}
public boolean isCacheValid() {
return _filtered != INVALID_VALUE;
}
void invalidateCache(Object key) {
if (_filtered == key) {
_filtered = INVALID_VALUE;
}
}
public void invalidateCache() {
_filtered = INVALID_VALUE;
}
Field Summary | |
---|---|
static Object |
INVALID_VALUE
A constant for invalid cache. |
Method Summary | |
---|---|
Object |
getCachedValue()
Gets the cached value. |
void |
invalidateCache()
Invalidates the cache. |
void |
invalidateCache(Object key)
Invalidates the cached value which matches the key. |
boolean |
isCacheValid()
Checks if the cache is valid. |
void |
setCachedValue(Object value)
Sets the cached value. |
Field Detail |
---|
static final Object INVALID_VALUE
Method Detail |
---|
Object getCachedValue()
void setCachedValue(Object value)
value
- the new cached value.boolean isCacheValid()
invalidateCache()
will make this method return false.
void invalidateCache(Object key)
INVALID_VALUE
if
current cached value matches the key.
key
- the keyvoid invalidateCache()
INVALID_VALUE
.
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |