Language:
Discover
By Skill Level
By Category

TPsoLruCache

Choose your OS:

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

bool

 

Contains

(
    const KeyType& Key
)

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

Public function

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

TArray < Valu...

 

FilterByPredicate

(
    Predicate Pred
)

Filter the entries in the cache using a predicate.

Public function

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 ValueT...

 

FindByPredicate

(
    Predicate Pred
)

Find the value of an entry using a predicate.

Public function

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

int32

 

Max()

Get the maximum number of entries in the cache.

Maximum number of entries.

Public function

int32

 

Num()

Get the number of entries in the cache.

Number of entries.

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.

Number of removed entries.

Public function

ValueType

 

RemoveLeastRecent()

Remove and return the least recent element from the cache.

Copy of removed value.

Public function

ValueType

 

RemoveMostRecent()

Remove and return the most recent element from the cache.

Copy of removed value.

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.

References

Module

RHI

Header

Runtime/RHI/Public/PsoLruCache.h