Cache.
More...
#include <base/collection/Cache.h>
Inherits Collection.
|
typedef KEY | Key |
|
typedef VALUE | Value |
|
template<class KEY, class VALUE>
class Cache< KEY, VALUE >
Cache.
Cache implementation.
- Version
- 1.0
◆ Cache() [1/3]
template<class KEY , class VALUE >
◆ Cache() [2/3]
template<class KEY , class VALUE >
Initializes the cache with the specified initial capacity.
◆ Cache() [3/3]
template<class KEY , class VALUE >
Initializes cache from other cache.
◆ add()
template<class KEY , class VALUE >
void Cache< KEY, VALUE >::add |
( |
const Key & |
key, |
|
|
const Value & |
value |
|
) |
| |
|
inline |
Adds the key and value to the cache.
◆ getSize()
template<class KEY , class VALUE >
MemorySize Cache< KEY, VALUE >::getSize |
( |
| ) |
const |
|
inlinenoexcept |
Returns the number of elements in the cache.
◆ getValue()
template<class KEY , class VALUE >
const Value& Cache< KEY, VALUE >::getValue |
( |
const Key & |
key | ) |
const |
|
inline |
Returns the value associated with the specified key. Raises InvalidKey if the specified key doesn't exist in the cache.
- Parameters
-
◆ isCached()
template<class KEY , class VALUE >
bool Cache< KEY, VALUE >::isCached |
( |
const Key & |
key | ) |
const |
|
inlinenoexcept |
Returns true if the specified object is in the cache.
◆ isEmpty()
template<class KEY , class VALUE >
bool Cache< KEY, VALUE >::isEmpty |
( |
| ) |
const |
|
inlinenoexcept |
Returns true if the cache is empty.
◆ operator=()
template<class KEY , class VALUE >
Cache& Cache< KEY, VALUE >::operator= |
( |
const Cache< KEY, VALUE > & |
assign | ) |
|
|
inlinenoexcept |
Assignment of cache by cache.
◆ operator[]() [1/2]
template<class KEY , class VALUE >
Returns the value associated with the specified key when used as 'rvalue'. When used as 'lvalue' the key is associated with the specified value.
◆ operator[]() [2/2]
template<class KEY , class VALUE >
const Value& Cache< KEY, VALUE >::operator[] |
( |
const Key & |
key | ) |
const |
|
inline |
Returns the value associated with the specified key.
◆ remove()
template<class KEY , class VALUE >
void Cache< KEY, VALUE >::remove |
( |
const Key & |
key | ) |
|
|
inline |
Removes the specified key and its associated value from this cache. Raises InvalidKey if the key doesn't exist in the cache.
◆ removeAll()
template<class KEY , class VALUE >
void Cache< KEY, VALUE >::removeAll |
( |
| ) |
|
|
inlinenoexcept |
Removes all the keys from the cache.
◆ operator<<()
template<class KEY , class VALUE >
Writes the content of the cache to the format output stream.
◆ elements
template<class KEY , class VALUE >