Lunchbox
1.9.1
|
Unified interface to save key-value pairs in a persistent store. More...
#include <persistentMap.h>
Public Member Functions | |
LUNCHBOX_API | PersistentMap (const std::string &uri=std::string()) |
Construct a new persistent map. More... | |
LUNCHBOX_API | ~PersistentMap () |
Destruct the persistent map. More... | |
LUNCHBOX_API bool | insert (const std::string &key, const std::string &value) |
Insert or update a value in the database. More... | |
LUNCHBOX_API std::string | operator[] (const std::string &key) const |
Retrieve a value for a key. More... | |
Unified interface to save key-value pairs in a persistent store.
Example:
Definition at line 35 of file persistentMap.h.
LUNCHBOX_API lunchbox::PersistentMap::PersistentMap | ( | const std::string & | uri = std::string() | ) |
Construct a new persistent map.
Depending on the URI scheme an implementation backend is chosen. If no URI is given, a default one is selected. Available implementations are:
uri | the storage backend and destination. |
std::runtime_error | if no suitable implementation is found. |
leveldb::Status | if opening the leveldb database failed. |
LUNCHBOX_API lunchbox::PersistentMap::~PersistentMap | ( | ) |
Destruct the persistent map.
LUNCHBOX_API bool lunchbox::PersistentMap::insert | ( | const std::string & | key, |
const std::string & | value | ||
) |
Insert or update a value in the database.
key | the key to store the value. |
value | the value stored at the key. |
LUNCHBOX_API std::string lunchbox::PersistentMap::operator[] | ( | const std::string & | key | ) | const |
Retrieve a value for a key.
key | the key to retreive. |