Navigation
API > API/Runtime > API/Runtime/Core
Implements a Least Recently Used (LRU) cache.
| Name | TLruCache |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Containers/LruCache.h |
| Include Path | #include "Containers/LruCache.h" |
Syntax
template<typename KeyType, typename ValueType, typename KeyComp>
class TLruCache
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TLruCache () |
Default constructor (empty cache that cannot hold any values). | Containers/LruCache.h | |
TLruCache
(
int32 InMaxNumElements |
Create and initialize a new instance. | Containers/LruCache.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~TLruCache() |
Destructor. | Containers/LruCache.h |
Classes
| Name | Remarks |
|---|---|
| TBaseIterator | Base class for cache iterators.Iteration begins at the most recent entry. |
| TConstIterator | Cache iterator (const). |
| TIterator | Cache iterator. |
Structs
| Name | Remarks |
|---|---|
| FCacheEntry | An entry in the LRU cache. |
| FKeyFuncs | Lookup set key functions. |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| LeastRecent | FCacheEntry * | Least recent item in the cache. | Containers/LruCache.h | |
| LookupSet | TSet< FCacheEntry *, FKeyFuncs > | Set of entries for fast lookup. | Containers/LruCache.h | |
| MaxNumElements | int32 | Maximum number of elements in the cache. | Containers/LruCache.h | |
| MostRecent | FCacheEntry * | Most recent item in the cache. | Containers/LruCache.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void Add
(
const KeyType& Key, |
Add an entry to the cache. | Containers/LruCache.h | |
ValueType & AddUninitialized_GetRef
(
const KeyType& Key |
Add an entry to the cache. | Containers/LruCache.h | |
| Containers/LruCache.h | |||
| Containers/LruCache.h | |||
bool Contains
(
const KeyType& Key |
Check whether an entry with the specified key is in the cache. | Containers/LruCache.h | |
bool ContainsByPredicate
(
Predicate Pred |
Check whether an entry for which a predicate returns true is in the cache. | Containers/LruCache.h | |
void Empty
(
int32 InMaxNumElements |
Empty the cache. | Containers/LruCache.h | |
| Containers/LruCache.h | |||
| Containers/LruCache.h | |||
TArray< ValueType > FilterByPredicate
(
Predicate Pred |
Filter the entries in the cache using a predicate. | Containers/LruCache.h | |
ValueType * Find
(
const KeyType& Key |
Find the value of the entry with the specified key. | Containers/LruCache.h | |
const ValueType * Find
(
const KeyType& Key |
Find the value of the entry with the specified key. | Containers/LruCache.h | |
ValueType * FindAndTouch
(
const KeyType& Key |
Find the value of the entry with the specified key and mark it as the most recently used. | Containers/LruCache.h | |
ValueType & FindAndTouchChecked
(
const KeyType& Key |
Find the value of the entry with the specified key and mark it as the most recently used. | Containers/LruCache.h | |
ValueType FindAndTouchRef
(
const KeyType& Key |
Find the value of the entry with the specified key and mark it as the most recently used. | Containers/LruCache.h | |
const ValueType * FindByPredicate
(
Predicate Pred |
Find the value of an entry using a predicate. | Containers/LruCache.h | |
ValueType & FindChecked
(
const KeyType& Key |
Find the value of the entry with the specified key. | Containers/LruCache.h | |
const ValueType & FindChecked
(
const KeyType& Key |
Find the value of the entry with the specified key. | Containers/LruCache.h | |
ValueType FindRef
(
const KeyType& Key |
Find the value of the entry with the specified key. | Containers/LruCache.h | |
| Find the keys of all cached entries. | Containers/LruCache.h | ||
KeyType GetLeastRecentKey() |
Return the least recent element key from the cache. | Containers/LruCache.h | |
bool IsEmpty () |
Returns true if the cache is empty and contains no elements. | Containers/LruCache.h | |
int32 Max () |
Get the maximum number of entries in the cache. | Containers/LruCache.h | |
int32 Num () |
Get the number of entries in the cache. | Containers/LruCache.h | |
void Remove
(
const KeyType& Key |
Remove all entries with the specified key from the cache. | Containers/LruCache.h | |
int32 RemoveByPredicate
(
Predicate Pred |
Remove all entries using a predicate. | Containers/LruCache.h | |
ValueType RemoveLeastRecent() |
Remove and return the least recent element from the cache. | Containers/LruCache.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void MarkAsRecent
(
FCacheEntry& Entry |
Mark the given entry as recently used. | Containers/LruCache.h | |
void Remove
(
FCacheEntry* Entry |
Remove the specified entry from the cache. | Containers/LruCache.h |