ConfigStore
Include fastly/config_store.h to use this class.
A Compute Config Store.
Methods
contains
View sourcefastly::expected<bool> fastly::config_store::ConfigStore::contains(std::string_view key)Return true if the config_store contains an entry with the given key.
Examples
Parameters
- key: std::string_view
Returns
fastly::expected<bool>
_runauto store{fastly::ConfigStore::open("test config store")};assert(store.contains("key").value());get
View sourcefastly::expected<std::optional<std::string>> fastly::config_store::ConfigStore::get(std::string_view key)Lookup a value in this config store.
If successful, this function returns std::optional<std::string>> if an entry was found, or std::nullopt if no entry with the given key was found.
Examples
Parameters
- key: std::string_view
Returns
fastly::expected<std::optional<std::string>>
123456789101112_runauto store{fastly::ConfigStore::open("test config store")};assert(store.get("bread").value() == "a usually baked and leavened food");
assert( store.get("freedom").value() == "the absence of necessity, coercion, or constraint",);
// Otherwise, `get` will return nullopt.assert(store.get("zzzzz") == std::nullopt);static fastly::expected<ConfigStore> fastly::config_store::ConfigStore::open(std::string_view name)Open a config store, given its name.
Examples
Parameters
- name: std::string_view
Returns
fastly::expected<ConfigStore>
_runauto merriam{fastly::ConfigStore::open("merriam webster")};auto oed{fastly::ConfigStore::open("oxford english config store")};