get
Get the entry associated with the given cache key, if it exists.
Returns nullopt if the key is not in the cache, or Body with the cached value if found.
Overload 1 of 2
tl::expected<std::optional<http::Body>, CacheError> fastly::cache::simple::get(std::span<const std::uint8_t> key)Get the entry associated with the given cache key, if it exists.
Returns nullopt if the key is not in the cache, or Body with the cached value if found.
Parameters
- key: std::span<const std::uint8_t>
Returns
tl::expected<std::optional<http::Body>, CacheError>
std::vector<std::uint8_t> key_bytes = {0x01, 0x02, 0x03};auto result = get(key_bytes);Overload 2 of 2
tl::expected<std::optional<http::Body>, CacheError> fastly::cache::simple::get(std::string_view key)Get the entry associated with the given cache key, if it exists.
Returns nullopt if the key is not in the cache, or Body with the cached value if found.
Parameters
- key: std::string_view
Returns
tl::expected<std::optional<http::Body>, CacheError>
auto result = get("my_key");