Class SampledPolicy
- java.lang.Object
-
- com.github.benmanes.caffeine.cache.simulator.policy.sampled.SampledPolicy
-
- All Implemented Interfaces:
Policy,Policy.KeyOnlyPolicy
public final class SampledPolicy extends Object implements Policy.KeyOnlyPolicy
A cache that uses a sampled array of entries to implement simple page replacement algorithms.The sampling approach for an approximation of classical policies is described Efficient Randomized Web Cache Replacement Schemes Using Samples from Past Eviction Times. The Hyperbolic algorithm is a newer addition to this family and is described in Hyperbolic Caching: Flexible Caching for Web Applications.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSampledPolicy.EvictionPolicyThe replacement policy.static classSampledPolicy.SampleThe algorithms to choose a random sample with.-
Nested classes/interfaces inherited from interface com.github.benmanes.caffeine.cache.simulator.policy.Policy
Policy.Characteristic, Policy.KeyOnlyPolicy, Policy.PolicySpec
-
-
Constructor Summary
Constructors Constructor Description SampledPolicy(Admission admission, SampledPolicy.EvictionPolicy policy, Config config)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Set<Policy>policies(Config config, SampledPolicy.EvictionPolicy policy)Returns all variations of this policy based on the configuration parameters.voidrecord(long key)PolicyStatsstats()Returns the cache efficiency statistics.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.benmanes.caffeine.cache.simulator.policy.Policy
finished, name
-
Methods inherited from interface com.github.benmanes.caffeine.cache.simulator.policy.Policy.KeyOnlyPolicy
record
-
-
-
-
Constructor Detail
-
SampledPolicy
public SampledPolicy(Admission admission, SampledPolicy.EvictionPolicy policy, Config config)
-
-
Method Detail
-
policies
public static Set<Policy> policies(Config config, SampledPolicy.EvictionPolicy policy)
Returns all variations of this policy based on the configuration parameters.
-
stats
public PolicyStats stats()
Description copied from interface:PolicyReturns the cache efficiency statistics.
-
record
public void record(long key)
- Specified by:
recordin interfacePolicy.KeyOnlyPolicy
-
-