|
| void | Add (const KeyType &Key, const ValueType &Value) |
| | Add an entry to the cache. 更多...
|
| |
| FORCEINLINE bool | Contains (const KeyType &Key) const |
| | Check whether an entry with the specified key is in the cache. 更多...
|
| |
| template<typename Predicate > |
| FORCEINLINE bool | ContainsByPredicate (Predicate Pred) const |
| | Check whether an entry for which a predicate returns true is in the cache. 更多...
|
| |
| void | Empty (int32 InMaxNumElements=0) |
| | Empty the cache. 更多...
|
| |
| template<typename Predicate > |
| TArray< ValueType > | FilterByPredicate (Predicate Pred) const |
| | Filter the entries in the cache using a predicate. 更多...
|
| |
| FORCEINLINE const ValueType * | Find (const KeyType &Key) const |
| | Find the value of the entry with the specified key. 更多...
|
| |
| const ValueType * | FindAndTouch (const KeyType &Key) |
| | Find the value of the entry with the specified key and mark it as the most recently used. 更多...
|
| |
| const ValueType & | FindAndTouchChecked (const KeyType &Key) |
| | Find the value of the entry with the specified key and mark it as the most recently used. 更多...
|
| |
| ValueType | FindAndTouchRef (const KeyType &Key) |
| | Find the value of the entry with the specified key and mark it as the most recently used. 更多...
|
| |
| template<typename Predicate > |
| const ValueType * | FindByPredicate (Predicate Pred) const |
| | Find the value of an entry using a predicate. 更多...
|
| |
| FORCEINLINE const ValueType & | FindChecked (const KeyType &Key) const |
| | Find the value of the entry with the specified key. 更多...
|
| |
| FORCEINLINE ValueType | FindRef (const KeyType &Key) const |
| | Find the value of the entry with the specified key. 更多...
|
| |
| void | GetKeys (TArray< KeyType > &OutKeys) const |
| | Find the keys of all cached entries. 更多...
|
| |
| FORCEINLINE int32 | Max () const |
| | Get the maximum number of entries in the cache. 更多...
|
| |
| FORCEINLINE int32 | Num () const |
| | Get the number of entries in the cache. 更多...
|
| |
| void | Remove (const KeyType &Key) |
| | Remove all entries with the specified key from the cache. 更多...
|
| |
| template<typename Predicate > |
| int32 | RemoveByPredicate (Predicate Pred) |
| | Remove all entries using a predicate. 更多...
|
| |
| FORCEINLINE ValueType | RemoveLeastRecent () |
| | Remove and return the least recent element from the cache. 更多...
|
| |
|
| TLruCache () |
| | Default constructor (empty cache that cannot hold any values).
|
| |
| | TLruCache (int32 InMaxNumElements) |
| | Create and initialize a new instance. 更多...
|
| |
|
| ~TLruCache () |
| | Destructor.
|
| |
template<typename KeyType, typename ValueType, typename KeyComp = DefaultKeyComparer<KeyType>>
class TLruCache< KeyType, ValueType, KeyComp >
Implements a Least Recently Used (LRU) cache.
- 参数
-
| KeyType | The type of cache entry keys. |
| ValueType | The type of cache entry values. |
| KeyFuncs | Optional functions for comparing keys in the lookup set (see BaseKeyFuncs in Set.h). |
template<typename KeyType , typename ValueType , typename KeyComp = DefaultKeyComparer<KeyType>>
| void TLruCache< KeyType, ValueType, KeyComp >::Add |
( |
const KeyType & |
Key, |
|
|
const ValueType & |
Value |
|
) |
| |
|
inline |
Add an entry to the cache.
If an entry with the specified key already exists in the cache, the value of the existing entry will be updated. The added or updated entry will be marked as the most recently used one.
- 参数
-
| Key | The entry's lookup key. |
| Value | The entry's value. |
- 参见
- Empty, Find, GetKeys, Remove