|
ModErn Text Analysis
META Enumerates Textual Applications
|
An incredibly simple "cache" that simply keeps everything in memory. More...
#include <no_evict_cache.h>
Public Member Functions | |
| void | insert (const Key &key, const Value &value) |
| Inserts the given key, value pair into the cache. More... | |
| util::optional< Value > | find (const Key &key) const |
| Finds the value associated with the given key. More... | |
| void | clear () |
| Clears the cache. | |
Private Attributes | |
| std::unique_ptr< std::mutex > | mutables_ {make_unique<std::mutex>()} |
| Mutex for locking operations. | |
| std::deque< util::optional< Value > > | values_ |
| Contains all of the values inserted thus far. More... | |
An incredibly simple "cache" that simply keeps everything in memory.
Useful for when the dataset is small enough that we have enough RAM to fit it in-core.
| void meta::caching::no_evict_cache< Key, Value >::insert | ( | const Key & | key, |
| const Value & | value | ||
| ) |
Inserts the given key, value pair into the cache.
May be slow while the cache is initially populated as it needs to resize the internal storage.
| key | the key to insert |
| value | the value to insert |
| util::optional< Value > meta::caching::no_evict_cache< Key, Value >::find | ( | const Key & | key | ) | const |
Finds the value associated with the given key.
| key | the key to find the associated value for, if it exists |
|
private |
Contains all of the values inserted thus far.
Never shrinks.
1.8.9.1