forked from blue/lmdbal
some test cases for cache, found some bugs, fixed
This commit is contained in:
parent
c23dae2a25
commit
ceb6df6eca
3 changed files with 55 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue