#include "abstract_cache.hpp"
template<typename KeyType, typename ValueType, typename T>
class iroha::cache::AbstractCache< KeyType, ValueType, T >
Cache for any key-value types. Internally it uses a map to cache ItemTypes and linked list based index of KeyTypes to remove oldest items when getIndexSizeHigh() is reached. Implemented as a CRTP pattern.
- Template Parameters
-
| KeyType | - type of cache keys |
| ValueType | - type of cache values |
| T | - type of implementation |
◆ addItem()
template<typename KeyType, typename ValueType, typename T>
Adds new item to cache. When amount of cache records reaches getIndexSizeHigh() a procedure of clean starts until getIndexSizeLow() records left. Note: cache does not have a remove method, deletion performs automatically. Since every add operation can potentially lead to deletion, it should be protected by mutex.
- Parameters
-
| key | - key to insert |
| value | - value to insert |
◆ findItem()
template<typename KeyType, typename ValueType, typename T>
Performs a search for an item with a specific key.
- Parameters
-
- Returns
- Optional of ValueType
◆ getCacheItemCount()
template<typename KeyType, typename ValueType, typename T>
- Returns
- amount of items in cache
◆ getIndexSizeHigh()
template<typename KeyType, typename ValueType, typename T>
The documentation for this class was generated from the following file: