forked from blue/lmdbal
0.3.0
This commit is contained in:
parent
66df0da5f6
commit
2b4763b575
9 changed files with 141 additions and 49 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue