template<typename KeyType, typename MappedType, class Hasher = AZStd::hash<KeyType>, class EqualKey = AZStd::equal_to<KeyType>, class Allocator = AZStd::allocator>
class AZStd::lru_cache< KeyType, MappedType, Hasher, EqualKey, Allocator >
This class is a simple map which keeps an least-recently-used list of elements. If the capacity of the map is exceeded with a new insertion, the oldest element is evicted.
template<typename KeyType , typename MappedType , class Hasher = AZStd::hash<KeyType>, class EqualKey = AZStd::equal_to<KeyType>, class Allocator = AZStd::allocator>
template<typename... Args>
pair_iter_bool AZStd::lru_cache< KeyType, MappedType, Hasher, EqualKey, Allocator >::emplace |
( |
const KeyType & |
key, |
|
|
Args &&... |
arguments |
|
) |
| |
|
inline |
Constructs a new MappedType with the provided arguments, associated with key. If the key already exists, replaces the existing mapped type. The entry is promoted to the most-recently-used.
template<typename KeyType , typename MappedType , class Hasher = AZStd::hash<KeyType>, class EqualKey = AZStd::equal_to<KeyType>, class Allocator = AZStd::allocator>
pair_iter_bool AZStd::lru_cache< KeyType, MappedType, Hasher, EqualKey, Allocator >::insert |
( |
const KeyType & |
key, |
|
|
const MappedType & |
value |
|
) |
| |
|
inline |
Inserts \rev value associated with key. If the key already exists, replaces the existing value. The entry is promoted to the most-recently-used.
template<typename KeyType , typename MappedType , class Hasher = AZStd::hash<KeyType>, class EqualKey = AZStd::equal_to<KeyType>, class Allocator = AZStd::allocator>
void AZStd::lru_cache< KeyType, MappedType, Hasher, EqualKey, Allocator >::set_capacity |
( |
size_t |
capacity | ) |
|
|
inline |
Adjusts the capacity of the container. If the new capacity is smaller than the existing size, elements will be evicted until the capacity is reached.