diff options
Diffstat (limited to 'include/utils/LruCache.h')
-rw-r--r-- | include/utils/LruCache.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/include/utils/LruCache.h b/include/utils/LruCache.h index 9248ac9..cd9d7f9 100644 --- a/include/utils/LruCache.h +++ b/include/utils/LruCache.h @@ -17,8 +17,8 @@ #ifndef ANDROID_UTILS_LRU_CACHE_H #define ANDROID_UTILS_LRU_CACHE_H +#include <UniquePtr.h> #include <utils/BasicHashtable.h> -#include <utils/UniquePtr.h> namespace android { @@ -48,6 +48,7 @@ public: bool remove(const TKey& key); bool removeOldest(); void clear(); + const TValue& peekOldestValue(); class Iterator { public: @@ -184,6 +185,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) { |