DODS 6.5 API

org.enhydra.dods.cache.lru
Class DODSLRUCache

java.lang.Object
  extended byorg.enhydra.dods.cache.lru.LRUCache
      extended byorg.enhydra.dods.cache.lru.DODSLRUCache
All Implemented Interfaces:
CacheStatistics, DODSCache, java.util.Map

public class DODSLRUCache
extends LRUCache
implements DODSCache

DODSLRUCache class implements LRU cache (for storing data objects (or DataStruct objects), or simple queries, or complex queries), and provides query statistics about the cache (query number, cache hits number, their get/set/increment methods, percents of used cache, cache hits,...).

Version:
2.0 15.06.2003.
Author:
Tanja Jovanovic, Nenad Vico, Zorica Suvajdzin

Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
protected  int cacheAccessNum
          Total number of times the cache was accessed.
protected  int cacheHitsNum
          Number of queries performed on the cache successfully.
 
Fields inherited from class org.enhydra.dods.cache.lru.LRUCache
maxEntries
 
Method Summary
 void clearStatistics()
          Clears statistics.
 int getCacheAccessNum()
          Returns total number of times the cache was accessed.
 int getCacheHitsNum()
          Returns number of queries performed on the cache successfully.
 double getCacheHitsPercents()
          Returns how much queries performed on the cache were successful.
 double getUsedPercents()
          Returns how much cache is currently used.
 void incrementCacheAccessNum(int num)
          Increases total number of times the cache was accessed.
 void incrementCacheHitsNum(int num)
          Increases number of queries performed on the cache successfully for one.
 boolean isNeedToSynchronize()
           
 void setCacheAccessNum(int num)
          Sets total number of times the cache was accessed.
 void setCacheHitsNum(int cacheHitsNum)
          Sets number of queries performed on the cache successfully.
 
Methods inherited from class org.enhydra.dods.cache.lru.LRUCache
add, clear, containsKey, containsValue, entrySet, equals, get, getMaxEntries, hashCode, isEmpty, keySet, put, putAll, remove, setMaxEntries, size, toString, values
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.enhydra.dods.cache.base.DODSCache
add, getMaxEntries, setMaxEntries
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Field Detail

cacheAccessNum

protected int cacheAccessNum
Total number of times the cache was accessed.


cacheHitsNum

protected int cacheHitsNum
Number of queries performed on the cache successfully.

Method Detail

getCacheAccessNum

public int getCacheAccessNum()
Returns total number of times the cache was accessed.

Specified by:
getCacheAccessNum in interface CacheStatistics
Returns:
total number of times the cache was accessed.

setCacheAccessNum

public void setCacheAccessNum(int num)
Sets total number of times the cache was accessed.

Specified by:
setCacheAccessNum in interface CacheStatistics
Parameters:
num - Total number of times the cache was accessed.

incrementCacheAccessNum

public void incrementCacheAccessNum(int num)
Increases total number of times the cache was accessed.

Specified by:
incrementCacheAccessNum in interface CacheStatistics

getCacheHitsNum

public int getCacheHitsNum()
Returns number of queries performed on the cache successfully.

Specified by:
getCacheHitsNum in interface CacheStatistics
Returns:
Number of queries performed on the cache successfully.

setCacheHitsNum

public void setCacheHitsNum(int cacheHitsNum)
Sets number of queries performed on the cache successfully.

Specified by:
setCacheHitsNum in interface CacheStatistics
Parameters:
cacheHitsNum - Number of queries performed on the cache successfully.

incrementCacheHitsNum

public void incrementCacheHitsNum(int num)
Increases number of queries performed on the cache successfully for one.

Specified by:
incrementCacheHitsNum in interface CacheStatistics

getUsedPercents

public double getUsedPercents()
Returns how much cache is currently used. This value is given in percents. If cache is unbounded, method returns 100%.

Specified by:
getUsedPercents in interface CacheStatistics
Returns:
Percents - how much cache is currently used.

getCacheHitsPercents

public double getCacheHitsPercents()
Returns how much queries performed on the cache were successful. This value is given in percents.

Specified by:
getCacheHitsPercents in interface CacheStatistics
Returns:
Percents - how much queries performed on the cache were successful.

clearStatistics

public void clearStatistics()
Clears statistics.

Specified by:
clearStatistics in interface CacheStatistics

isNeedToSynchronize

public boolean isNeedToSynchronize()
Specified by:
isNeedToSynchronize in interface DODSCache

DODS 6.5 API