1
0
Fork 0
forked from blue/lmdbal

serializer for QByteArray, method to read all records

This commit is contained in:
Blue 2022-10-15 13:54:34 +03:00
parent 24e1dca5ea
commit 928558539c
Signed by untrusted user: blue
GPG key ID: 9B203B252A63EE38
7 changed files with 111 additions and 0 deletions

View file

@ -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) {