tuwien.auto.calimero.buffer.cache
Class StatisticImpl

java.lang.Object
  extended by tuwien.auto.calimero.buffer.cache.StatisticImpl
All Implemented Interfaces:
Cache.Statistic

public class StatisticImpl
extends java.lang.Object
implements Cache.Statistic

Provide basic Cache information as required by Cache.Statistic.

This statistics implementation is immutable.

See Also:
Cache.Statistic

Constructor Summary
StatisticImpl(long hits, long misses)
          Creates an instance and fills it with data.
 
Method Summary
 double hitRatio()
          Returns the ratio between found CacheObjects to total requests through Cache.get(Object).
 long hits()
          Returns the total number of successful requests with Cache.get(Object) for a CacheObject.
 long misses()
          Returns the total number of CacheObject not found with Cache.get(Object).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatisticImpl

public StatisticImpl(long hits,
                     long misses)
Creates an instance and fills it with data.

Parameters:
hits - cache hit count
misses - cache miss count
Method Detail

hitRatio

public final double hitRatio()
Description copied from interface: Cache.Statistic
Returns the ratio between found CacheObjects to total requests through Cache.get(Object).

This value is obtained through ratio = (hits / (hits + misses)).

Specified by:
hitRatio in interface Cache.Statistic
Returns:
the hit ratio in the range [0,1]

hits

public final long hits()
Description copied from interface: Cache.Statistic
Returns the total number of successful requests with Cache.get(Object) for a CacheObject.

Specified by:
hits in interface Cache.Statistic
Returns:
total hits

misses

public final long misses()
Description copied from interface: Cache.Statistic
Returns the total number of CacheObject not found with Cache.get(Object).

Specified by:
misses in interface Cache.Statistic
Returns:
total misses