UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TDiscardableKeyValueCache< KeyType, ValueType > Class Template Reference

#include <DiscardableKeyValueCache.h>

Classes

struct  LockFlags
 

Public Types

typedef TMap< KeyType, ValueType > TypedMap
 

Public Member Functions

 TDiscardableKeyValueCache ()
 
FRWLockRWLock ()
 
TypedMapCurrent ()
 
TypedMapBackfill ()
 
int32 Num ()
 
bool Find (const KeyType &Key, ValueType &OutType)
 
bool Find (const KeyType &Key, ValueType &OutType, uint32 InCurrentLockFlags, uint32 &OutLockFlags)
 
bool Add (const KeyType &Key, const ValueType &Value)
 
bool Add (const KeyType &Key, const ValueType &Value, const uint32 LockFlags)
 
int32 Discard ()
 
template<typename DeleteFunc >
int32 Discard (DeleteFunc Func)
 
template<typename DeleteFunc >
int32 Discard (uint32 InCurrentLockFlags, uint32 &OutNewLockFlags, DeleteFunc Func)
 
uint32 ApplyLock (uint32 CurrentFlags, uint32 NewFlags)
 
void Unlock (uint32 Flags)
 

Protected Member Functions

bool InternalFindWhileLocked (const KeyType &Key, ValueType &OutType, uint32 InCurrentLockFlags, uint32 &OutFlags)
 

Protected Attributes

FRWLock LockObject
 
TypedMapCurrentMap
 
TypedMapBackfillMap
 
TypedMap Map1
 
TypedMap Map2
 

Member Typedef Documentation

◆ TypedMap

template<class KeyType , class ValueType >
typedef TMap<KeyType, ValueType> TDiscardableKeyValueCache< KeyType, ValueType >::TypedMap

Constructor & Destructor Documentation

◆ TDiscardableKeyValueCache()

template<class KeyType , class ValueType >
TDiscardableKeyValueCache< KeyType, ValueType >::TDiscardableKeyValueCache ( )
inline

Member Function Documentation

◆ Add() [1/2]

template<class KeyType , class ValueType >
bool TDiscardableKeyValueCache< KeyType, ValueType >::Add ( const KeyType &  Key,
const ValueType &  Value 
)
inline

Add an entry to the current map. Can fail if another thread has inserted a matching object, in which case another call to Find() should succeed

◆ Add() [2/2]

template<class KeyType , class ValueType >
bool TDiscardableKeyValueCache< KeyType, ValueType >::Add ( const KeyType &  Key,
const ValueType &  Value,
const uint32  LockFlags 
)
inline

Add an entry to the current map. Can fail if another thread has inserted a matching object, in which case another call to Find() should succeed

◆ ApplyLock()

template<class KeyType , class ValueType >
uint32 TDiscardableKeyValueCache< KeyType, ValueType >::ApplyLock ( uint32  CurrentFlags,
uint32  NewFlags 
)
inline

◆ Backfill()

template<class KeyType , class ValueType >
TypedMap & TDiscardableKeyValueCache< KeyType, ValueType >::Backfill ( )
inline

◆ Current()

template<class KeyType , class ValueType >
TypedMap & TDiscardableKeyValueCache< KeyType, ValueType >::Current ( )
inline

◆ Discard() [1/3]

template<class KeyType , class ValueType >
int32 TDiscardableKeyValueCache< KeyType, ValueType >::Discard ( )
inline

◆ Discard() [2/3]

template<class KeyType , class ValueType >
template<typename DeleteFunc >
int32 TDiscardableKeyValueCache< KeyType, ValueType >::Discard ( DeleteFunc  Func)
inline

◆ Discard() [3/3]

template<class KeyType , class ValueType >
template<typename DeleteFunc >
int32 TDiscardableKeyValueCache< KeyType, ValueType >::Discard ( uint32  InCurrentLockFlags,
uint32 OutNewLockFlags,
DeleteFunc  Func 
)
inline

Discard all items in the backfill and swap the current & backfill pointers

◆ Find() [1/2]

template<class KeyType , class ValueType >
bool TDiscardableKeyValueCache< KeyType, ValueType >::Find ( const KeyType &  Key,
ValueType &  OutType 
)
inline

Returns true and sets OutType to the value with the associated key if it exists.

◆ Find() [2/2]

template<class KeyType , class ValueType >
bool TDiscardableKeyValueCache< KeyType, ValueType >::Find ( const KeyType &  Key,
ValueType &  OutType,
uint32  InCurrentLockFlags,
uint32 OutLockFlags 
)
inline

Externally-lock-aware Find function.

InFlags represents the currently locked state of the object, OutFlags the state after the find operation has completed. Caller should be sure to unlock this object with OutFlags

◆ InternalFindWhileLocked()

template<class KeyType , class ValueType >
bool TDiscardableKeyValueCache< KeyType, ValueType >::InternalFindWhileLocked ( const KeyType &  Key,
ValueType &  OutType,
uint32  InCurrentLockFlags,
uint32 OutFlags 
)
inlineprotected

Checks for the entry in our current map, and if not found the backfill. If the entry is in the backfill it is moved to the current map so it will not be discarded when DiscardUnusedEntries is called

◆ Num()

template<class KeyType , class ValueType >
int32 TDiscardableKeyValueCache< KeyType, ValueType >::Num ( )
inline

◆ RWLock()

template<class KeyType , class ValueType >
FRWLock & TDiscardableKeyValueCache< KeyType, ValueType >::RWLock ( )
inline

◆ Unlock()

template<class KeyType , class ValueType >
void TDiscardableKeyValueCache< KeyType, ValueType >::Unlock ( uint32  Flags)
inline

Member Data Documentation

◆ BackfillMap

template<class KeyType , class ValueType >
TypedMap* TDiscardableKeyValueCache< KeyType, ValueType >::BackfillMap
protected

◆ CurrentMap

template<class KeyType , class ValueType >
TypedMap* TDiscardableKeyValueCache< KeyType, ValueType >::CurrentMap
protected

◆ LockObject

template<class KeyType , class ValueType >
FRWLock TDiscardableKeyValueCache< KeyType, ValueType >::LockObject
protected

◆ Map1

template<class KeyType , class ValueType >
TypedMap TDiscardableKeyValueCache< KeyType, ValueType >::Map1
protected

◆ Map2

template<class KeyType , class ValueType >
TypedMap TDiscardableKeyValueCache< KeyType, ValueType >::Map2
protected

The documentation for this class was generated from the following file: