|
BuildCache
|
Provide access to a local key/value store. More...
#include <data_store.hpp>
Classes | |
| class | item_t |
| A data item. More... | |
Public Member Functions | |
| data_store_t (const std::string &name) | |
| Construct a data store. More... | |
| void | store_item (const std::string &key, const std::string &value, const time::seconds_t timeout) |
| Add or overwrite a data item. More... | |
| item_t | get_item (const std::string &key) |
| Get a data item. More... | |
| void | remove_item (const std::string &key) |
| Remove a data item. More... | |
| void | clear () |
| Clear the data store. | |
Private Member Functions | |
| std::string | make_file_path (const std::string &key) |
| void | perform_housekeeping () |
Private Attributes | |
| std::string | m_root_dir |
Provide access to a local key/value store.
The key/value store provides a convenient way to store data that is to be shared between multiple BuildCache instances on a local machine.
The values are not stored indefinitely. For instance, the store may be cleared between system sessions, and values that are stored in the data store may have an expiry time after which they are considered invalid.
| bcache::data_store_t::data_store_t | ( | const std::string & | name | ) |
Construct a data store.
| name | Name of the data store. |
| data_store_t::item_t bcache::data_store_t::get_item | ( | const std::string & | key | ) |
Get a data item.
| key | The key of the item to retrieve. |
| void bcache::data_store_t::remove_item | ( | const std::string & | key | ) |
Remove a data item.
| key | The ID of the item to retrieve. |
| void bcache::data_store_t::store_item | ( | const std::string & | key, |
| const std::string & | value, | ||
| const time::seconds_t | timeout | ||
| ) |
Add or overwrite a data item.
| key | The ID of the item to store. |
| value | The data to store. |
| timeout | The life time of the item. |
1.8.17