purge_with_opts

Functionin simplecompute-sdk-cpp 0.7.0

Purge the entry associated with the given cache key with specific options.

The PurgeOptions argument determines the scope of the purge operation.

Note: Purged values may persist in cache for a short time (~150ms or less) after this function returns.

Example POP-scoped purge (default):

Example global-scoped purge:

Overload 1 of 2

tl::expected<void, CacheError> fastly::cache::simple::purge_with_opts(std::span<const std::uint8_t> key, const PurgeOptions &opts)
View source

Purge the entry associated with the given cache key with specific options.

The PurgeOptions argument determines the scope of the purge operation.

Note: Purged values may persist in cache for a short time (~150ms or less) after this function returns.

Example POP-scoped purge (default):

Example global-scoped purge:

Parameters

key: std::span<const std::uint8_t>
opts: const PurgeOptions &

Returns

tl::expected<void, CacheError>
std::vector<std::uint8_t> key_bytes = {0x01, 0x02, 0x03};
purge_with_opts(key_bytes, PurgeOptions::pop_scope());
// Equivalent to just: purge(key_bytes);
std::vector<std::uint8_t> key_bytes = {0x01, 0x02, 0x03};
purge_with_opts(key_bytes, PurgeOptions::global_scope());

Overload 2 of 2

tl::expected<void, CacheError> fastly::cache::simple::purge_with_opts(std::string_view key, const PurgeOptions &opts)
View source

Purge the entry associated with the given cache key with specific options.

The PurgeOptions argument determines the scope of the purge operation.

Note: Purged values may persist in cache for a short time (~150ms or less) after this function returns.

Example POP-scoped purge (default):

Example global-scoped purge:

Parameters

key: std::string_view
opts: const PurgeOptions &

Returns

tl::expected<void, CacheError>
purge_with_opts("my_key", PurgeOptions::pop_scope());
// Equivalent to just: purge("my_key");
purge_with_opts("my_key", PurgeOptions::global_scope());