Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/Containers
References
| Module | Core |
| Header | /Engine/Source/Runtime/Core/Public/Containers/DiscardableKeyValueCache.h |
| Include | #include "Containers/DiscardableKeyValueCache.h" |
Syntax
template<class KeyType, class ValueType>
class TDiscardableKeyValueCache
Remarks
Implements a thread-safe discardable Key/Value cache by using two maps - a primary and a backfill.
Find() checks the current map first then the backfill. Entries found in the backfill are moved into the primary map.
When Swap is called all items in the backfill are removed and the currentmap & backfill are swapped.
This results in most recently used items being retained and older/unused items being evicted. The more often Swap is called the shorter the lifespan for items
Variables
| Type | Name | Description | |
|---|---|---|---|
| TypedMap * | BackfillMap | ||
| TypedMap * | CurrentMap | ||
| FRWLock | LockObject | ||
| TypedMap | Map1 | ||
| TypedMap | Map2 |
Constructors
| Type | Name | Description | |
|---|---|---|---|
Functions
| Type | Name | Description | |
|---|---|---|---|
| bool | Add
(
const KeyType& Key, |
Add an entry to the current map. | |
| bool | Add
(
const KeyType& Key, |
Add an entry to the current map. | |
| uint32 | ApplyLock
(
uint32 CurrentFlags, |
||
| TypedMap & | Backfill () |
Reference to the current map | |
| TypedMap & | Current () |
Reference to the current map | |
| int32 | Discard () |
Discard all items left in the backfill and swap the current & backfill pointers | |
| int32 | Discard
(
DeleteFunc Func |
||
| int32 | Discard
(
uint32 InCurrentLockFlags, |
Discard all items in the backfill and swap the current & backfill pointers | |
| bool | Find
(
const KeyType& Key, |
Returns true and sets OutType to the value with the associated key if it exists. | |
| bool | Find
(
const KeyType& Key, |
Externally-lock-aware Find function. | |
| bool | InternalFindWhileLocked
(
const KeyType& Key, |
Checks for the entry in our current map, and if not found the backfill. | |
| int32 | Num () |
Returns the total number of items in the cache | |
| FRWLock & | RWLock () |
Access to the internal locking object | |
| void | Unlock
(
uint32 Flags |
Classes
Typedefs
| Name | Description |
|---|---|
| TypedMap |