| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final int | DEFAULT_SAMPLE_SIZE
The sample size to use |
| pack-priv static final Random | RANDOM
Used to select random numbers |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static int | Returns: the smaller of the map size and the default sample size of 30the size of the store populationSize)sampleSize how many samples to take |
| public static int[] | Returns: a list of random offsetsthe size to draw from populationSize)Generates a random sample from a population |
| public Element | Returns: the least hitthis should be a random subset of the population sampledElements, Element we never want to select the element just added. May be null. justAdded)Implements net. |
| DEFAULT_SAMPLE_SIZE | back to summary |
|---|---|
| pack-priv static final int DEFAULT_SAMPLE_SIZE The sample size to use | |
| RANDOM | back to summary |
|---|---|
| pack-priv static final Random RANDOM Used to select random numbers | |
| AbstractPolicy | back to summary |
|---|---|
| public AbstractPolicy() | |
| calculateSampleSize | back to summary |
|---|---|
| public static int calculateSampleSize(int populationSize) sampleSize how many samples to take
| |
| generateRandomSample | back to summary |
|---|---|
| public static int[] generateRandomSample(int populationSize) Generates a random sample from a population
| |
| selectedBasedOnPolicy | back to summary |
|---|---|
| public Element selectedBasedOnPolicy(Element[] sampledElements, Element justAdded) Implements net. Finds the best eviction candidate based on the sampled elements. What distuingishes this approach from the classic data structures approach, is that an Element contains metadata which can be used for making policy decisions, while generic data structures do not. | |