1
0
Fork 0
forked from blue/lmdbal

some test cases for cache, found some bugs, fixed

This commit is contained in:
Blue 2022-10-09 17:03:30 +03:00
parent c23dae2a25
commit ceb6df6eca
Signed by untrusted user: blue
GPG key ID: 9B203B252A63EE38
3 changed files with 55 additions and 4 deletions

View file

@ -100,7 +100,7 @@ V DataBase::Cache<K, V>::getRecord(const K& key) const {
return itr->second;
}
if (*mode == Mode::full || abscent->count(key) == 0) {
if (*mode == Mode::full || abscent->count(key) != 0) {
throw NotFound(DataBase::_Table::toString(key), DataBase::Table<K, V>::db->name, DataBase::Table<K, V>::name);
}
@ -169,12 +169,13 @@ void DataBase::Cache<K, V>::handleMode() const {
}
template<class K, class V>
void DataBase::Cache<K, V>::drop() {
DataBase::Table<K, V>::drop();
int DataBase::Cache<K, V>::drop(MDB_txn * transaction) {
int res = DataBase::Table<K, V>::drop(transaction);
cache->clear();
abscent->clear();
*mode = Mode::full;
*sizeDifference = 0;
return res;
}
#endif //DATABASE_CACHE_HPP