MySQL 8.4.2
Source Code Documentation
|
Template for management of a free list based on a std::vector. More...
#include <free_list.h>
Public Member Functions | |
Free_list () | |
size_t | length () const |
void | add_last (E *element) |
Add an element to the end of the free list. More... | |
void | remove (E *element) |
Remove an element from the free list. More... | |
E * | get_lru () const |
Get the least recently used element in the list, i.e., the first element. More... | |
void | dump () const |
Debug dump of the free list to stderr. More... | |
Private Types | |
typedef std::vector< E *, Malloc_allocator< E * > > | List_type |
Private Attributes | |
List_type | m_list |
Template for management of a free list based on a std::vector.
The free list template defines functions mostly wrapping the std::vector functions, but additionally doing some asserts to ensure correct usage.
The first element in the free list is the least recently used element. When a new element becomes unused, it is added to the end of the free list. An element may also be removed from within the middle of the free list when the element is being acquired. This use case means iterating through the vector to find the correct element.
E | Element type (a Cache_element wrapping some dictionary object type). |
|
private |
|
inline |
|
inline |
Add an element to the end of the free list.
element | Element to add to the end of the list. |
|
inline |
Debug dump of the free list to stderr.
|
inline |
Get the least recently used element in the list, i.e., the first element.
|
inline |
|
inline |
Remove an element from the free list.
element | Element to be removed from the list. |
|
private |