diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/utils/LruCache.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/utils/LruCache.h b/include/utils/LruCache.h index fa8f03f..f615a32 100644 --- a/include/utils/LruCache.h +++ b/include/utils/LruCache.h @@ -48,6 +48,7 @@ public: bool remove(const TKey& key); bool removeOldest(); void clear(); + const TValue& peekOldestValue(); class Iterator { public: @@ -180,6 +181,14 @@ bool LruCache<TKey, TValue>::removeOldest() { } 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) { for (Entry* p = mOldest; p != NULL; p = p->child) { |