|
olp-cpp-sdk
1.23.1
|
An interface for a cache that expects a key-value pair. More...
#include <KeyValueCache.h>

Public Types | |
| using | ValueType = std::vector< unsigned char > |
| The value type that is stored in the DB. | |
| using | ValueTypePtr = std::shared_ptr< ValueType > |
| The shared pointer type of the DB entry. | |
| using | KeyListType = std::vector< std::string > |
| An alias for the list of keys to be protected or released. | |
Public Member Functions | |
| virtual bool | Put (const std::string &key, const boost::any &value, const Encoder &encoder, time_t expiry=kDefaultExpiry)=0 |
| Stores the key-value pair in the cache. More... | |
| virtual bool | Put (const std::string &key, const ValueTypePtr value, time_t expiry=kDefaultExpiry)=0 |
| Stores the raw binary data as a value in the cache. More... | |
| virtual boost::any | Get (const std::string &key, const Decoder &encoder)=0 |
| Gets the key-value pair from the cache. More... | |
| virtual ValueTypePtr | Get (const std::string &key)=0 |
| Gets the key and binary data from the cache. More... | |
| virtual bool | Remove (const std::string &key)=0 |
| Removes the key-value pair from the cache. More... | |
| virtual bool | RemoveKeysWithPrefix (const std::string &prefix)=0 |
| Removes the values with the keys that match the given prefix from the cache. More... | |
| virtual bool | Contains (const std::string &key) const |
| Checks if the key is in the cache. More... | |
| virtual bool | Protect (const KeyListType &keys) |
| Protects keys from eviction. More... | |
| virtual bool | Release (const KeyListType &keys) |
| Removes a list of keys from protection. More... | |
| virtual bool | IsProtected (const std::string &key) const |
| Checks if key is protected. More... | |
| virtual void | Promote (const std::string &key) |
| Promotes a key in the cache LRU when applicable. More... | |
| virtual OperationOutcome< ValueTypePtr > | Read (const std::string &key) |
| Gets the binary data from the cache. More... | |
| virtual OperationOutcomeEmpty | Write (const std::string &key, const ValueTypePtr &value, time_t expiry=kDefaultExpiry) |
| Stores the raw binary data as a value in the cache. More... | |
| virtual OperationOutcomeEmpty | Delete (const std::string &key) |
| Removes the key-value pair from the cache. More... | |
| virtual OperationOutcomeEmpty | DeleteByPrefix (const std::string &prefix) |
| Removes the values with the keys that match the given prefix from the cache. More... | |
Static Public Attributes | |
| static constexpr time_t | kDefaultExpiry = std::numeric_limits<time_t>::max() |
| The expiry time of the key-value pair. More... | |
An interface for a cache that expects a key-value pair.
|
inlinevirtual |
Checks if the key is in the cache.
| key | The key for the value. |
Reimplemented in olp::cache::DefaultCache.
|
inlinevirtual |
Removes the key-value pair from the cache.
| key | The key for the value. |
Reimplemented in olp::cache::DefaultCache.
|
inlinevirtual |
Removes the values with the keys that match the given prefix from the cache.
| prefix | The prefix that matches the keys. |
Reimplemented in olp::cache::DefaultCache.
|
pure virtual |
Gets the key and binary data from the cache.
| key | The key that is used to look for the binary data. |
Implemented in olp::cache::DefaultCache.
|
pure virtual |
Gets the key-value pair from the cache.
| key | The key that is used to look for the key-value pair. |
| encoder | Decodes the value from a string. |
Implemented in olp::cache::DefaultCache.
|
inlinevirtual |
Checks if key is protected.
| key | The key or prefix. |
Reimplemented in olp::cache::DefaultCache.
|
inlinevirtual |
Promotes a key in the cache LRU when applicable.
| key | The key to promote in the cache LRU. |
Reimplemented in olp::cache::DefaultCache.
|
inlinevirtual |
Protects keys from eviction.
You can use keys or prefixes to protect single keys or entire catalogs, layers, or version.
| keys | The list of keys or prefixes. |
Reimplemented in olp::cache::DefaultCache.
|
pure virtual |
Stores the key-value pair in the cache.
| key | The key for this value. |
| value | The value of any type. |
| encoder | Encodes the specified value into a string. |
| expiry | The expiry time (in seconds) of the key-value pair. |
Implemented in olp::cache::DefaultCache.
|
pure virtual |
Stores the raw binary data as a value in the cache.
| key | The key for this value. |
| value | The binary data that should be stored. |
| expiry | The expiry time (in seconds) of the key-value pair. |
Implemented in olp::cache::DefaultCache.
|
inlinevirtual |
Gets the binary data from the cache.
| key | The key that is used to look for the binary data. |
Reimplemented in olp::cache::DefaultCache.
|
inlinevirtual |
Removes a list of keys from protection.
The provided keys can be full keys or prefixes only.
| keys | The list of keys or prefixes. |
Reimplemented in olp::cache::DefaultCache.
|
pure virtual |
Removes the key-value pair from the cache.
| key | The key for the value. |
Implemented in olp::cache::DefaultCache.
|
pure virtual |
Removes the values with the keys that match the given prefix from the cache.
| prefix | The prefix that matches the keys. |
Implemented in olp::cache::DefaultCache.
|
inlinevirtual |
Stores the raw binary data as a value in the cache.
| key | The key for this value. |
| value | The binary data that should be stored. |
| expiry | The expiry time (in seconds) of the key-value pair. |
Reimplemented in olp::cache::DefaultCache.
|
staticconstexpr |
The expiry time of the key-value pair.
By default, the key-value pair has no expiry time.