27#include <unordered_map>
36template <
typename Data_extension>
38 std::unordered_map<meta::Metadata, Data_extension, meta::Metadata::Hash>;
40template <
typename Data_extension = data::Data>
65 auto it =
cache_.find(metadata);
66 if (it ==
cache_.end())
return false;
81 bool ok =
cache_.insert({metadata, data}).second;
95 bool removed =
cache_.erase(metadata) != 0;
126 return cache_.find(metadata);
bool erase(const meta::Metadata metadata)
Remove an entry from cache.
Definition: cache.h:94
Cache< Data_extension >::const_iterator at(const meta::Metadata metadata) const
Retrieve iterator at an element from cache.
Definition: cache.h:124
Datacache & operator=(const Datacache &src)=delete
void clear()
Clear the cache.
Definition: cache.h:101
Cache< Data_extension >::const_iterator begin() const
Definition: cache.h:113
size_t version() const
Get cache version.
Definition: cache.h:110
Cache< Data_extension > cache_
Sensitive data cache.
Definition: cache.h:131
size_t size() const
Get size.
Definition: cache.h:107
~Datacache()=default
Destructor.
Datacache(const Datacache &src)=delete
Disable copy.
Datacache(Datacache &&src)=delete
bool store(const meta::Metadata metadata, const Data_extension data)
Store and element in cache.
Definition: cache.h:80
Cache< Data_extension >::const_iterator end() const
Definition: cache.h:116
Datacache & operator=(Datacache &&src)=delete
bool empty() const
Check if cache is empty.
Definition: cache.h:104
Datacache()
Constructor.
Definition: cache.h:44
size_t version_
Cache version.
Definition: cache.h:133
bool get(const meta::Metadata metadata, Data_extension &data) const
Retrieve an element from cache.
Definition: cache.h:64
std::unordered_map< meta::Metadata, Data_extension, meta::Metadata::Hash > Cache
Definition: cache.h:38
Definition: keyring_encryption_service_definition.h:32