A splay_cache is a fixed-size splay tree for cache operations.
More...
#include <splay_cache.h>
|
uint64_t | size_ |
| the current size of the cache
|
|
uint64_t | max_size_ |
| the maximum allowed size for the cache
|
|
node * | root_ |
| the root of the tree
|
|
std::mutex | mutables_ |
| the mutex that synchronizes access to the cache
|
|
template<class Key, class Value>
class meta::caching::splay_cache< Key, Value >
A splay_cache is a fixed-size splay tree for cache operations.
template<class Key , class Value >
Creates a splay tree cache with maximum size (or unlimited size, if no size is given).
- Parameters
-
max_size | The maximum number of nodes that will be in the splay tree |
template<class Key , class Value >
template<class Key , class Value >
- Parameters
-
key | The key to insert |
value | The value to insert |
If the key exists in the map, it will be overwritten.
template<class Key , class Value >
- Parameters
-
key | The key to find the corresponding value for |
- Returns
- an optional containing the associated value for the given key, if found
template<class Key , class Value >
- Returns
- the number of elements in the cache
template<class Key , class Value >
Deletes everything at this subroot and below.
- Parameters
-
subroot | The root of the subtree to clear |
template<class Key , class Value >
Inserts the given key, value pair into the tree rooted at subroot.
- Parameters
-
subroot | The root of the subtree to insert into |
key | |
value | |
template<class Key , class Value >
Replaces the key, value pair contained in the node pointed to by subroot with the given key, value pair.
- Parameters
-
template<class Key , class Value >
"Finds" the given key in the tree rooted at subroot.
This function does not return anything because it splays the desired value to the root, so the public find() can simply return the root after calling this function.
- Parameters
-
template<class Key , class Value >
Rotates the tree rooted at subroot to the left.
- Parameters
-
template<class Key , class Value >
Rotates the tree rooted at subroot to the right.
- Parameters
-
The documentation for this class was generated from the following files: