Redis · Schema

Redis Key-Value Entry

A Redis key and its associated value, type, and metadata.

CacheDatabaseIn-MemoryKey-Value StoreNoSQLOpen SourceStreaming

Properties

Name Type Description
key string The Redis key. Keys are arbitrary binary-safe strings, conventionally namespaced with colons (e.g., user:1234:profile).
type string The Redis data type for this key.
value object The value stored at this key. Type depends on the Redis data type.
ttl integer Time-to-live in seconds. -1 means no expiry. -2 means the key does not exist.
encoding string Internal Redis encoding for the value (e.g., embstr, raw, ziplist, listpack, skiplist, quicklist, hashtable).
View JSON Schema on GitHub

JSON Schema

redis-key-value-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://redis.io/schemas/key-value.json",
  "title": "Redis Key-Value Entry",
  "description": "A Redis key and its associated value, type, and metadata.",
  "type": "object",
  "required": ["key"],
  "properties": {
    "key": {
      "type": "string",
      "description": "The Redis key. Keys are arbitrary binary-safe strings, conventionally namespaced with colons (e.g., user:1234:profile)."
    },
    "type": {
      "type": "string",
      "enum": ["string", "list", "set", "zset", "hash", "stream", "json", "none"],
      "description": "The Redis data type for this key."
    },
    "value": {
      "description": "The value stored at this key. Type depends on the Redis data type.",
      "oneOf": [
        { "type": "string", "description": "String value." },
        { "type": "array", "description": "List or set value.", "items": { "type": "string" } },
        { "type": "object", "description": "Hash or JSON value." }
      ]
    },
    "ttl": {
      "type": "integer",
      "description": "Time-to-live in seconds. -1 means no expiry. -2 means the key does not exist.",
      "minimum": -2
    },
    "encoding": {
      "type": "string",
      "description": "Internal Redis encoding for the value (e.g., embstr, raw, ziplist, listpack, skiplist, quicklist, hashtable)."
    }
  }
}