public class ResetPeriodicallyHitRatio extends Object implements HitRatio
Concurrency properties:
Usage recommendations:
SmoothlyDecayingRollingHitRatio| Constructor and Description |
|---|
ResetPeriodicallyHitRatio(Duration resetInterval)
Constructs the hit-ratio which reset its state to zero each time when
resetInterval is elapsed. |
ResetPeriodicallyHitRatio(Duration resetInterval,
Ticker ticker) |
| Modifier and Type | Method and Description |
|---|---|
double |
getHitRatio()
Returns the ratio between hits and misses
|
void |
update(int hitCount,
int totalCount)
Registers an result of bulk operations.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitincrementHitCount, incrementMissCountpublic ResetPeriodicallyHitRatio(Duration resetInterval)
resetInterval is elapsed.resetInterval - the interval between counter resettingpublic void update(int hitCount,
int totalCount)
HitRatioExample of usage:
Set<Something> cachedValues = cache.get(keys);
hitRatio.update(cachedValues.size(), keys.size());
public double getHitRatio()
HitRatiogetHitRatio in interface HitRatioCopyright © 2020. All rights reserved.