com.ls.util.cache
Class CacheStatistic

java.lang.Object
  |
  +--com.ls.util.cache.CacheStatistic

public class CacheStatistic
extends Object

Statistic class that can be used by any cacher class. In this class the following information are followed.

- The number of data that retrieved from the cache successfully
- The number of data that were invalid when user wanted to access
- The number of data that were not exist in the hash when user requested
- The number of data that were removed by garbage collector when user requested

Version:
$Revision: 1.1 $
Author:
Last modified by $Author: TBerk $

Constructor Summary
CacheStatistic()
          Constructor, that initialize the internal variables
CacheStatistic(int newFromCache, int newInvalidData, int newNoData, int newRemovedFromMemory)
          Constructor, that initialize the variables
 
Method Summary
 StringBuffer getStatistics()
          Returns the statistics of this cache
 void incFromCache()
          Increases number of data that retrieved from cache successfully
 void incInvalidData()
          Increases number of data that are invalid when user wants to access
 void incNoData()
          Increases the number of data that were not exist in the hash when user requested
 void incRemovedFromMemory()
          Increases the number of data that were removed by garbage collector when user requested
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheStatistic

public CacheStatistic()
Constructor, that initialize the internal variables

CacheStatistic

public CacheStatistic(int newFromCache,
                      int newInvalidData,
                      int newNoData,
                      int newRemovedFromMemory)
Constructor, that initialize the variables
Parameters:
newFromCache - initial value for fromCache variable
newInvalidData - initial value for invalidData variable
newNoData - initial value for noData variable
newRemovedFromMemory - initial value for removedFromMemory variable
Method Detail

incFromCache

public void incFromCache()
Increases number of data that retrieved from cache successfully

incInvalidData

public void incInvalidData()
Increases number of data that are invalid when user wants to access

incNoData

public void incNoData()
Increases the number of data that were not exist in the hash when user requested

incRemovedFromMemory

public void incRemovedFromMemory()
Increases the number of data that were removed by garbage collector when user requested

getStatistics

public StringBuffer getStatistics()
Returns the statistics of this cache
Returns:
A StringBuffer which has the details of the current cache.