CacheClient

interface CacheClient

Swappable backend for hash-based cache operations.

Functions

Link copied to clipboard
abstract suspend fun del(vararg keys: String): Long

Remove one or more whole hashes. Returns the number of removed keys.

Link copied to clipboard
abstract suspend fun exists(key: String): Boolean

Returns true if the key exists (has at least one field).

Link copied to clipboard
open suspend fun expire(key: String, ttl: <Error class: unknown class>)

Optional: set TTL on the whole hash. No-op by default.

Link copied to clipboard
abstract suspend fun hdel(key: String, vararg fields: String): Long

Remove one or more fields. Returns the number of removed fields.

Link copied to clipboard
open suspend fun hexpire(key: String, ttl: <Error class: unknown class>, vararg fields: String)

Optional: set per-field TTL (Redis 7.4+). No-op by default.

Link copied to clipboard
abstract suspend fun hget(key: String, field: String): String?

Get a single field value. Returns null if the key or field does not exist.

Link copied to clipboard
abstract suspend fun hgetAll(key: String): Map<String, String>

Return every field-value pair in the hash.

Link copied to clipboard
abstract suspend fun hset(key: String, entries: Map<String, String>): Long

Set multiple fields. Returns the number of newly-added fields.

abstract suspend fun hset(key: String, field: String, value: String): Boolean

Set a field value. Returns true if a new field was added, false if updated.