Changeset View
Changeset View
Standalone View
Standalone View
src/cuckoocache.h
Show First 20 Lines • Show All 169 Lines • ▼ Show 20 Lines | private: | ||||
/** | /** | ||||
* epoch_flags tracks how recently an element was inserted into the cache. | * epoch_flags tracks how recently an element was inserted into the cache. | ||||
* true denotes recent, false denotes not-recent. See insert() method for | * true denotes recent, false denotes not-recent. See insert() method for | ||||
* full semantics. | * full semantics. | ||||
*/ | */ | ||||
mutable std::vector<bool> epoch_flags; | mutable std::vector<bool> epoch_flags; | ||||
/** | /** | ||||
* epoch_heuristic_counter is used to determine when a epoch might be aged & | * epoch_heuristic_counter is used to determine when an epoch might be aged | ||||
* an expensive scan should be done. epoch_heuristic_counter is decremented | * & an expensive scan should be done. epoch_heuristic_counter is | ||||
* on insert and reset to the new number of inserts which would cause the | * decremented on insert and reset to the new number of inserts which would | ||||
* epoch to reach epoch_size when it reaches zero. | * cause the epoch to reach epoch_size when it reaches zero. | ||||
*/ | */ | ||||
uint32_t epoch_heuristic_counter; | uint32_t epoch_heuristic_counter; | ||||
/** | /** | ||||
* epoch_size is set to be the number of elements supposed to be in a epoch. | * epoch_size is set to be the number of elements supposed to be in a epoch. | ||||
* When the number of non-erased elements in a epoch exceeds epoch_size, a | * When the number of non-erased elements in an epoch exceeds epoch_size, a | ||||
* new epoch should be started and all current entries demoted. epoch_size | * new epoch should be started and all current entries demoted. epoch_size | ||||
* is set to be 45% of size because we want to keep load around 90%, and we | * is set to be 45% of size because we want to keep load around 90%, and we | ||||
* support 3 epochs at once -- one "dead" which has been erased, one "dying" | * support 3 epochs at once -- one "dead" which has been erased, one "dying" | ||||
* which has been marked to be erased next, and one "living" which new | * which has been marked to be erased next, and one "living" which new | ||||
* inserts add to. | * inserts add to. | ||||
*/ | */ | ||||
uint32_t epoch_size; | uint32_t epoch_size; | ||||
▲ Show 20 Lines • Show All 266 Lines • Show Last 20 Lines |