Added Cache::size()
This commit is contained in:
parent
73101b74ea
commit
5bb77adc87
8
implementations/caching/cache/Cache.h
vendored
8
implementations/caching/cache/Cache.h
vendored
@ -26,6 +26,8 @@ public:
|
|||||||
Cache();
|
Cache();
|
||||||
virtual ~Cache();
|
virtual ~Cache();
|
||||||
|
|
||||||
|
uint32_t size() const;
|
||||||
|
|
||||||
void push(const Key &key, Value value);
|
void push(const Key &key, Value value);
|
||||||
boost::optional<Value> pop(const Key &key);
|
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();
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
implementations/caching/cache/QueueMap.h
vendored
2
implementations/caching/cache/QueueMap.h
vendored
@ -66,7 +66,7 @@ public:
|
|||||||
return _sentinel.next->value();
|
return _sentinel.next->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t size() {
|
uint32_t size() const {
|
||||||
return _entries.size();
|
return _entries.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user