forked from blue/lmdbal
serializer for QByteArray, method to read all records
This commit is contained in:
parent
24e1dca5ea
commit
928558539c
7 changed files with 111 additions and 0 deletions
16
cache.hpp
16
cache.hpp
|
@ -115,6 +115,22 @@ V DataBase::Cache<K, V>::getRecord(const K& key) const {
|
|||
}
|
||||
}
|
||||
|
||||
template<class K, class V>
|
||||
std::map<K, V> DataBase::Cache<K, V>::readAll() const {
|
||||
if (!DataBase::Table<K, V>::db->opened) {
|
||||
throw Closed("readAll", DataBase::Table<K, V>::db->name, DataBase::Table<K, V>::name);
|
||||
}
|
||||
|
||||
if (*mode != Mode::full) { //there is a room for optimization
|
||||
*mode = Mode::full; //I can read and deserialize only those values
|
||||
*cache = DataBase::Table<K, V>::readAll(); //that are missing in the cache
|
||||
abscent->clear();
|
||||
*sizeDifference = 0;
|
||||
}
|
||||
|
||||
return *cache;
|
||||
}
|
||||
|
||||
template<class K, class V>
|
||||
void DataBase::Cache<K, V>::removeRecord(const K& key) {
|
||||
if (!DataBase::Table<K, V>::db->opened) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue