InsertBuilder

Classin kv_storecompute-sdk-cpp 0.7.0View source

Include fastly/kv_store.h to use this class.

Methods

background_fetch

View source
InsertBuilder fastly::kv_store::InsertBuilder::background_fetch() &&

If set, allows fetching from the origin to occur in the background, enabling a faster response with stale content. The cache will be updated with fresh content after the request is completed.

Returns

expected fastly::kv_store::InsertBuilder::execute(const std::string &key, Body body) &&

Initiate and wait on an insert of a value into the KV Store. The return object is engaged if the value was inserted, and KVStoreError if the insert failed.

Parameters

key: const std::string &
body: Body

Returns

execute_async

View source
expected<PendingInsertHandle> fastly::kv_store::InsertBuilder::execute_async(const std::string &key, Body body) &&

Initiate async insert of a value into the KV Store.

Parameters

key: const std::string &
body: Body

Returns

if_generation_match

View source
InsertBuilder fastly::kv_store::InsertBuilder::if_generation_match(std::uint64_t gen) &&

Requests for keys will return a ‘generation’ header specific to the version of a key. The generation header is a unique, non-serial 64-bit unsigned integer that can be used for testing against a specific KV store value.

Parameters

gen: std::uint64_t

Returns

metadata

View source
InsertBuilder fastly::kv_store::InsertBuilder::metadata(const std::string &data) &&

Sets an arbitrary data field which can contain up to 2000B of data.

Parameters

data: const std::string &

Returns

InsertBuilder fastly::kv_store::InsertBuilder::mode(InsertMode mode) &&

Change the behavior in the case when the new key matches an existing key.

Parameters

mode: InsertMode

Returns

time_to_live

View source
InsertBuilder fastly::kv_store::InsertBuilder::time_to_live(std::chrono::milliseconds ttl) &&

Sets a time for the key to expire. Deletion will take place up to 24 hours after the ttl reaches 0.

Parameters

ttl: std::chrono::milliseconds

Returns