SimpleLru¶
-
class
SimpleLru
¶ Bases:
LinkedListNode
,Namable
An implementation of a very simple LRU algorithm. Also see
AdaptiveLru
.Inheritance diagram
-
explicit
SimpleLru
(std::string const &name, std::size_t max_size)¶
-
void
begin_epoch
(void)¶ Marks the end of the previous epoch and the beginning of the next one. This will evict any objects that are pending eviction, and also update any internal bookkeeping.
-
void
consider_evict
(void)¶ Evicts a sequence of objects if the queue is full.
-
std::size_t
count_active_size
(void) const¶ Returns the total size of the pages that were enqueued since the last call to
begin_epoch()
.
-
void
evict_to
(std::size_t target_size)¶ Evicts a sequence of objects until the queue fits within the indicated target size, regardless of its normal max size.
-
std::size_t
get_max_size
(void) const¶ Returns the max size of all objects that are allowed to be active on the LRU.
-
std::size_t
get_total_size
(void) const¶ Returns the total size of all objects currently active on the LRU.
-
void
output
(std::ostream &out) const¶
-
void
set_max_size
(std::size_t max_size)¶ Changes the max size of all objects that are allowed to be active on the LRU.
If the size is (size_t)-1, there is no limit.
-
bool
validate
(void)¶ Checks that the LRU is internally self-consistent. Returns true if successful, false if there is some problem.
-
void
write
(std::ostream &out, int indent_level) const¶
-
explicit