52 if (_total_size > _max_size) {
53 do_evict_to(_max_size,
false);
65 if (_total_size > _max_size) {
66 do_evict_to(_max_size,
false);
80 if (_total_size > target_size) {
81 do_evict_to(target_size,
true);
109 return do_validate();
117 INLINE SimpleLruPage::
118 SimpleLruPage(
size_t lru_size) :
129 INLINE SimpleLruPage::
132 _lru_size(copy._lru_size)
141 INLINE
void SimpleLruPage::
169 _lru->_total_size -= _lru_size;
222 _lru->_total_size -= _lru_size;
223 _lru->_total_size += lru_size;
224 _lru_size = lru_size;
226 _lru_size = lru_size;
size_t get_total_size() const
Returns the total size of all objects currently active on the LRU.
void consider_evict()
Evicts a sequence of objects if the queue is full.
An implementation of a very simple LRU algorithm.
void mark_used_lru() const
To be called when the page is used; this will move it to the tail of the SimpleLru queue it is alread...
void enqueue_lru(SimpleLru *lru)
Adds the page to the LRU for the first time, or marks it recently-accessed if it has already been add...
void dequeue_lru()
Removes the page from its SimpleLru.
void begin_epoch()
Marks the end of the previous epoch and the beginning of the next one.
size_t get_lru_size() const
Returns the size of this page as reported to the LRU, presumably in bytes.
void set_lru_size(size_t lru_size)
Specifies the size of this page, presumably in bytes, although any unit is possible.
Similar to MutexHolder, but for a light mutex.
One atomic piece that may be managed by a SimpleLru chain.
void evict_to(size_t target_size)
Evicts a sequence of objects until the queue fits within the indicated target size, regardless of its normal max size.
void set_max_size(size_t max_size)
Changes the max size of all objects that are allowed to be active on the LRU.
size_t get_max_size() const
Returns the max size of all objects that are allowed to be active on the LRU.
SimpleLru * get_lru() const
Returns the LRU that manages this page, or NULL if it is not currently managed by any LRU...
bool validate()
Checks that the LRU is internally self-consistent.