Merge "Add a peekOldestValue"
This commit is contained in:
commit
8af196c1f5
1 changed files with 9 additions and 0 deletions
|
|
@ -48,6 +48,7 @@ public:
|
|||
bool remove(const TKey& key);
|
||||
bool removeOldest();
|
||||
void clear();
|
||||
const TValue& peekOldestValue();
|
||||
|
||||
class Iterator {
|
||||
public:
|
||||
|
|
@ -179,6 +180,14 @@ bool LruCache<TKey, TValue>::removeOldest() {
|
|||
return false;
|
||||
}
|
||||
|
||||
template <typename TKey, typename TValue>
|
||||
const TValue& LruCache<TKey, TValue>::peekOldestValue() {
|
||||
if (mOldest) {
|
||||
return mOldest->value;
|
||||
}
|
||||
return mNullValue;
|
||||
}
|
||||
|
||||
template <typename TKey, typename TValue>
|
||||
void LruCache<TKey, TValue>::clear() {
|
||||
if (mListener) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue