/// FastEdge cache interface (synchronous variant).
interface cache-sync {
use cache-types.{payload, error};
/// Get the value associated with `key`.
///
/// Returns:
/// - `ok(some(value))` if the key exists.
/// - `ok(none)` if the key does not exist.
/// - `err(error)` if the operation fails.
get: func(key: string) -> result<option<payload>, error>;
/// Set the value for `key` with an optional expiry.
///
/// If the key already exists, its current value is overwritten.
/// If the key does not exist, a new key-value pair is created.
///
/// `ttl-ms` is the time-to-live in milliseconds. Pass `none` for no expiry.
///
/// Returns `err(error)` if the operation fails.
set: func(key: string, value: payload, ttl-ms: option<u64>) -> result<_, error>;
/// Delete the key-value pair associated with `key`.
///
/// If the key does not exist, this operation is a no-op.
///
/// Returns `err(error)` if the operation fails.
delete: func(key: string) -> result<_, error>;
/// Check whether `key` exists in the cache.
///
/// Returns:
/// - `ok(true)` if the key exists.
/// - `ok(false)` if the key does not exist.
/// - `err(error)` if the operation fails.
exists: func(key: string) -> result<bool, error>;
/// Increment the integer value stored at `key` by `delta`.
///
/// If the key does not exist, it is initialised to `0` before incrementing.
/// The operation is atomic. `delta` may be negative to decrement.
///
/// Returns the new value after the increment, or `err(error)` if the
/// operation fails (for example, if the stored value is not an integer).
incr: func(key: string, delta: s64) -> result<s64, error>;
/// Set or update the expiry of `key` to `ttl-ms` milliseconds from now.
///
/// If the key does not exist, returns `ok(false)`.
/// If the expiry was updated successfully, returns `ok(true)`.
/// Returns `err(error)` if the operation fails.
expire: func(key: string, ttl-ms: u64) -> result<bool, error>;
}