JIDE 3.5.15

com.jidesoft.grid
Interface Cacheable

All Known Implementing Classes:
DefaultGroupRow, IndexReferenceRow

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

INVALID_VALUE

static final Object INVALID_VALUE
A constant for invalid cache.

Method Detail

getCachedValue

Object getCachedValue()
Gets the cached value.

Returns:
the cached value.

setCachedValue

void setCachedValue(Object value)
Sets the cached value.

Parameters:
value - the new cached value.

isCacheValid

boolean isCacheValid()
Checks if the cache is valid. invalidateCache() will make this method return false.

Returns:
true if valid.

invalidateCache

void invalidateCache(Object key)
Invalidates the cached value which matches the key. It just set the cached value to INVALID_VALUE if current cached value matches the key.

Parameters:
key - the key

invalidateCache

void invalidateCache()
Invalidates the cache. It just set the cached value to INVALID_VALUE.


JIDE 3.5.15