D++ (DPP)
C++ Discord API Bot Library
|
A cache object maintains a cache of dpp::managed objects. This is for example users, channels or guilds. More...
#include <cache.h>
Public Member Functions | |
cache () | |
Construct a new cache object. More... | |
~cache () | |
Destroy the cache object. More... | |
void | store (managed *object) |
void | remove (managed *object) |
managed * | find (snowflake id) |
uint64_t | count () |
std::mutex & | get_mutex () |
Return the cache's locking mutex. Use this whenever you manipulate or iterate raw elements in the cache! More... | |
cache_container & | get_container () |
Get the container map. More... | |
void | rehash () |
"Rehash" a cache by cleaning out used RAM More... | |
size_t | bytes () |
Get "real" size in RAM of the cache. More... | |
A cache object maintains a cache of dpp::managed objects. This is for example users, channels or guilds.
dpp::cache::cache | ( | ) |
Construct a new cache object.
dpp::cache::~cache | ( | ) |
Destroy the cache object.
size_t dpp::cache::bytes | ( | ) |
Get "real" size in RAM of the cache.
uint64_t dpp::cache::count | ( | ) |
Return a count of the number of items in the cache.
Find an object in the cache by id.
id | Object id to find |
cache_container & dpp::cache::get_container | ( | ) |
Get the container map.
std::mutex & dpp::cache::get_mutex | ( | ) |
Return the cache's locking mutex. Use this whenever you manipulate or iterate raw elements in the cache!
void dpp::cache::rehash | ( | ) |
"Rehash" a cache by cleaning out used RAM
void dpp::cache::remove | ( | managed * | object | ) |
Remove an object from the cache.
object | object to remove |
void dpp::cache::store | ( | managed * | object | ) |
Store an object in the cache.
object | object to store |