Module |
|
Header |
/Engine/Source/Runtime/Core/Public/Containers/DiscardableKeyValueCache.h |
Include |
#include "Containers/DiscardableKeyValueCache.h" |
template<class KeyType, class ValueType>
class TDiscardableKeyValueCache
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
Name | Description | |
---|---|---|
|
TDiscardableKeyValueCache() |
Name | Description | ||
---|---|---|---|
|
Add ( |
Add an entry to the current map. |
|
|
Add ( |
Add an entry to the current map. |
|
|
ApplyLock |
||
|
TypedMap & |
Backfill() |
Reference to the current map |
|
TypedMap & |
Current() |
Reference to the current map |
|
Discard() |
Discard all items left in the backfill and swap the current & backfill pointers |
|
|
Discard ( |
||
|
Discard |
Discard all items in the backfill and swap the current & backfill pointers |
|
|
Find ( |
Returns true and sets OutType to the value with the associated key if it exists. |
|
|
Find |
Externally-lock-aware Find function. |
|
|
InternalFindWhileLocked |
Checks for the entry in our current map, and if not found the backfill. |
|
|
Num() |
Returns the total number of items in the cache |
|
|
FRWLock & |
RWLock() |
Access to the internal locking object |
|
Unlock ( |
Name |
Description |
---|---|
TypedMap |