Memory cache helper class with expiration time. More...
#include <memory_cache.h>
Public Member Functions | |
| MemoryCache (std::chrono::seconds lifetime) | |
| Constructor. More... | |
| void | Add (K key, const T &item) |
| Add an item to the cache. More... | |
| bool | TryGet (K key, T &item) |
| Try to get an item from the cache. More... | |
Memory cache helper class with expiration time.
| K | Cache key type |
| T | Cached value type |
|
inlineexplicit |
Constructor.
| lifetime | Cached item lifetime in seconds |
|
inline |
Add an item to the cache.
| key | Item cache key |
| item | Item to be cached |
|
inline |
Try to get an item from the cache.
| [in] | key | Item cache key |
| [out] | item | Cached item |