1
0
Fork 0
forked from blue/lmdbal
This commit is contained in:
Blue 2023-04-12 12:36:33 -03:00
parent 66df0da5f6
commit 2b4763b575
Signed by untrusted user: blue
GPG key ID: 9B203B252A63EE38
9 changed files with 141 additions and 49 deletions

View file

@ -22,9 +22,29 @@
#include "cache.h"
#include "exceptions.h"
/**
* \class LMDBAL::Cache
* \brief Storage with additional caching in std::map
*
* \tparam K type of the keys of the cache
* \tparam V type of the values of the cache
*
* You can receive an instance of this class calling LMDBAL::Base::addCache(const std::string&)
* if the database is yet closed and you're defining the storages you're going to need.
* Or you can call LMDBAL::Base::getCache(const std::string&) if you didn't save a pointer to the cache at first
*
* You are not supposed to instantiate or destory instances of this class yourself!
*/
/**
* \brief Creates a cache
*
* \param[in] _name - name of the new cache
* \param[in] parent - parent database pointed (borrowed)
*/
template<class K, class V>
LMDBAL::Cache<K, V>::Cache(const std::string& p_name, Base* parent):
Storage<K, V>(p_name, parent),
LMDBAL::Cache<K, V>::Cache(const std::string& _name, Base* parent):
Storage<K, V>(_name, parent),
mode(new Mode),
cache(new std::map<K, V>()),
abscent(new std::set<K>()),
@ -35,6 +55,9 @@ LMDBAL::Cache<K, V>::Cache(const std::string& p_name, Base* parent):
*sizeDifference = 0;
}
/**
* \brief Destroys a cache
*/
template<class K, class V>
LMDBAL::Cache<K, V>::~Cache() {
delete transactionCache;