TPsoLruCache

Implements a Least Recently Used (LRU) cache.

Windows
MacOS
Linux

References

Module

RHI

Header

/Engine/Source/Runtime/RHI/Public/PsoLruCache.h

Include

#include "PsoLruCache.h"

Syntax

template<typename KeyType, typename ValueType>
class TPsoLruCache

Remarks

Implements a Least Recently Used (LRU) cache.

Constructors

Name Description

Public function

TPsoLruCache()

Default constructor (empty cache that cannot hold any values).

Public function

TPsoLruCache

(
    int32 InMaxNumElements
)

Create and initialize a new instance.

Destructors

Name Description

Public function

~TPsoLruCache()

Destructor.

Functions

Name Description

Public function

FSetElementI...

 

Add

(
    const KeyType& Key,
    const ValueType& Value
)

Add an entry to the cache.

Public function Const

bool

 

Contains

(
    const KeyType& Key
)

Check whether an entry with the specified key is in the cache.

Public function Const

bool

 

ContainsByPredicate

(
    Predicate Pred
)

Check whether an entry for which a predicate returns true is in the cache.

Public function

void

 

Empty

(
    int32 InMaxNumElements
)

Empty the cache.

Public function Const

TArray< Valu...

 

FilterByPredicate

(
    Predicate Pred
)

Filter the entries in the cache using a predicate.

Public function Const

const ValueT...

 

Find

(
    const KeyType& Key
)

Find the value of the entry with the specified key.

Public function

const ValueT...

 

FindAndTouch

(
    const KeyType& Key
)

Find the value of the entry with the specified key and mark it as the most recently used.

Public function Const

const ValueT...

 

FindByPredicate

(
    Predicate Pred
)

Find the value of an entry using a predicate.

Public function Const

void

 

GetKeys

(
    TArray< KeyType >& OutKeys
)

Find the keys of all cached entries.

Protected function

void

 

MarkAsRecent

(
    FCacheEntry& Entry
)

Mark the given entry as recently used.

Public function

void

 

MarkAsRecent

(
    const FSetElementId& LRUNode
)

Public function Const

int32

 

Max()

Get the maximum number of entries in the cache.

Public function Const

int32

 

Num()

Get the number of entries in the cache.

Public function

void

 

Remove

(
    const KeyType& Key
)

Remove all entries with the specified key from the cache.

Protected function

void

 

Remove

(
    FCacheEntry* Entry
)

Remove the specified entry from the cache.

Public function

bool

 

Remove

(
    const KeyType& Key,
    ValueType& RemovedValue
)

Public function

int32

 

RemoveByPredicate

(
    Predicate Pred
)

Remove all entries using a predicate.

Public function

ValueType

 

RemoveLeastRecent()

Remove and return the least recent element from the cache.

Public function

ValueType

 

RemoveMostRecent()

Remove and return the most recent element from the cache.

Classes

Name

Description

Public class

TBaseIterator

Base class for cache iterators.

Iteration begins at the most recent entry.

Public class

TConstIterator

Cache iterator (const).

Public class

TIterator

Cache iterator.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss