One atomic piece that may be managed by a SimpleLru chain. More...
#include "simpleLru.h"
Public Member Functions | |
SimpleLruPage (size_t lru_size) | |
SimpleLruPage (const SimpleLruPage ©) | |
void | dequeue_lru () |
Removes the page from its SimpleLru. More... | |
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 added. More... | |
virtual void | evict_lru () |
Evicts the page from the LRU. More... | |
SimpleLru * | get_lru () const |
Returns the LRU that manages this page, or NULL if it is not currently managed by any LRU. More... | |
size_t | get_lru_size () const |
Returns the size of this page as reported to the LRU, presumably in bytes. More... | |
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 already on. More... | |
void | mark_used_lru (SimpleLru *lru) |
To be called when the page is used; this will move it to the tail of the specified SimpleLru queue. More... | |
void | operator= (const SimpleLruPage ©) |
virtual void | output (std::ostream &out) const |
void | set_lru_size (size_t lru_size) |
Specifies the size of this page, presumably in bytes, although any unit is possible. More... | |
virtual void | write (std::ostream &out, int indent_level) const |
Friends | |
class | SimpleLru |
One atomic piece that may be managed by a SimpleLru chain.
To use this class, inherit from it and override evict_lru().
Definition at line 65 of file simpleLru.h.
|
inline |
Removes the page from its SimpleLru.
Definition at line 134 of file simpleLru.I.
Referenced by evict_lru(), and GeomVertexArrayData::evict_lru().
void SimpleLruPage::enqueue_lru | ( | SimpleLru * | lru | ) |
Adds the page to the LRU for the first time, or marks it recently-accessed if it has already been added.
If lru is NULL, it means to remove this page from its LRU.
Definition at line 64 of file simpleLru.cxx.
Referenced by SimpleLru::begin_epoch(), and mark_used_lru().
|
virtual |
Evicts the page from the LRU.
Called internally when the LRU determines that it is full. May also be called externally when necessary to explicitly evict the page.
It is legal for this method to either evict the page as requested, do nothing (in which case the eviction will be requested again at the next epoch), or requeue itself on the tail of the queue (in which case the eviction will be requested again much later).
Reimplemented in GeomVertexArrayData.
Definition at line 229 of file simpleLru.cxx.
References dequeue_lru().
|
inline |
Returns the LRU that manages this page, or NULL if it is not currently managed by any LRU.
Definition at line 125 of file simpleLru.I.
|
inline |
Returns the size of this page as reported to the LRU, presumably in bytes.
Definition at line 171 of file simpleLru.I.
|
inline |
To be called when the page is used; this will move it to the tail of the SimpleLru queue it is already on.
This method is const because it's not technically modifying the contents of the page itself.
Definition at line 152 of file simpleLru.I.
Referenced by VertexDataPage::get_page_data(), and GeomVertexArrayData::operator=().
|
inline |
To be called when the page is used; this will move it to the tail of the specified SimpleLru queue.
Definition at line 163 of file simpleLru.I.
References enqueue_lru().
|
inline |
Specifies the size of this page, presumably in bytes, although any unit is possible.
Definition at line 180 of file simpleLru.I.