org.das2.dataset
Class AbstractDataSetCache

java.lang.Object
  extended by org.das2.dataset.AbstractDataSetCache
All Implemented Interfaces:
DataSetCache
Direct Known Subclasses:
LimitCountDataSetCache, LimitSizeBytesDataSetCache, SimpleDataSetCache

public abstract class AbstractDataSetCache
extends java.lang.Object
implements DataSetCache

Keeps keep track of cache statistics and to give consistent log messages, and provides the Entry class.


Nested Class Summary
protected  class AbstractDataSetCache.Entry
           
 
Field Summary
 int hits
           
 int misses
           
 
Constructor Summary
AbstractDataSetCache()
           
 
Method Summary
protected  long cacheValue(AbstractDataSetCache.Entry e)
          return a measure of the utility of the entry, presumably so that it may be swapped out when a resource limit is met.
 DataSet coalese(java.util.List result)
          return the DataSet described by the set of DataSets if possible.
 boolean haveStored(DataSetDescriptor dsd, CacheTag cacheTag)
           
 boolean isResetCache()
          Getter for property resetCache.
abstract  void reset()
          reset the internal state of the cache
 DataSet retrieve(DataSetDescriptor dsd, CacheTag cacheTag)
           
 void setResetCache(boolean resetCache)
          Setter for property resetCache.
abstract  void store(DataSetDescriptor dsd, CacheTag cacheTag, DataSet data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hits

public int hits

misses

public int misses
Constructor Detail

AbstractDataSetCache

public AbstractDataSetCache()
Method Detail

store

public abstract void store(DataSetDescriptor dsd,
                           CacheTag cacheTag,
                           DataSet data)
Specified by:
store in interface DataSetCache

haveStored

public boolean haveStored(DataSetDescriptor dsd,
                          CacheTag cacheTag)
Specified by:
haveStored in interface DataSetCache

cacheValue

protected long cacheValue(AbstractDataSetCache.Entry e)
return a measure of the utility of the entry, presumably so that it may be swapped out when a resource limit is met.


retrieve

public DataSet retrieve(DataSetDescriptor dsd,
                        CacheTag cacheTag)
Specified by:
retrieve in interface DataSetCache

reset

public abstract void reset()
reset the internal state of the cache

Specified by:
reset in interface DataSetCache

coalese

public DataSet coalese(java.util.List result)
return the DataSet described by the set of DataSets if possible.

Throws:
java.lang.IllegalArgumentException - if a subset is not continous, non-overlapping, and of the same resolution. Removes elements from the list that are not needed for the set.

isResetCache

public boolean isResetCache()
Getter for property resetCache.

Returns:
Value of property resetCache.

setResetCache

public void setResetCache(boolean resetCache)
Setter for property resetCache.

Parameters:
resetCache - New value of property resetCache.