Added Cache::size()

This commit is contained in:
Sebastian Messmer 2015-10-05 16:51:36 +02:00
parent 73101b74ea
commit 5bb77adc87
2 changed files with 9 additions and 1 deletions

View File

@ -26,6 +26,8 @@ public:
Cache();
virtual ~Cache();
uint32_t size() const;
void push(const Key &key, Value value);
boost::optional<Value> pop(const Key &key);
@ -135,6 +137,12 @@ bool Cache<Key, Value>::_deleteOldEntry() {
}
};
template<class Key, class Value>
uint32_t Cache<Key, Value>::size() const {
std::unique_lock<std::mutex> lock(_mutex);
return _cachedBlocks.size();
};
}
}

View File

@ -66,7 +66,7 @@ public:
return _sentinel.next->value();
}
uint32_t size() {
uint32_t size() const {
return _entries.size();
}