# Hanzo KV — Hanzo AI > Managed Redis/Valkey for caching, sessions, rate limiting, and pub/sub. In-memory data store # Hanzo KV In-memory key-value store Values live in memory, so a read is a network hop and a hash lookup — nothing waits on a disk. KV speaks RESP2 and RESP3 on port 6379, so the client library you already have connects to it. Reach for it for caches, sessions, rate limits, job queues and leaderboards. RESP 2 and 3 Sentinel Failover AOF Persistence Cluster Sharding [Get Started](https://docs.hanzo.ai/docs/kv)[GitHub](https://github.com/hanzoai/kv) ## Pick a structure, not a schema A leaderboard is a sorted set. A rate limit is a counter with an expiry. A queue is a list. ### Nothing touches a disk Reads and writes are answered out of memory, so the time you spend is the network and a hash lookup. That is the whole reason to put a cache in front of a database. ### The structures do the work Strings, hashes, lists, sets, sorted sets, streams, bitmaps, HyperLogLog and geospatial indexes — each with the commands that make sense for it. Lua scripts run several commands as one atomic step when a single command is not enough. ### Pub/Sub Publish to a channel and every subscriber has it, including subscribers matching a pattern like orders.*. Keyspace notifications turn a key expiring into a message something else can act on. ### Keys that expire Put a TTL on any key and it goes away by itself. When memory fills, you choose what leaves first — least recently used, least frequently used, shortest time to live, or only keys that already carry an expiry. ### Two ways to survive a restart An RDB snapshot writes the whole dataset on an interval; the append-only file records every write as it happens. Run either or both, and check a file before you trust it with kv-check-rdb and kv-check-aof. ### ACLs on commands and keys A user is granted specific commands and specific key patterns, so the service that only reads cache keys cannot reach FLUSHALL. TLS on the wire. ## Any RESP client connects cache.ts ``` import Redis from "ioredis" const kv = new Redis("redis://kv.hanzo.ai:6379") // Caching await kv.set("user:123", JSON.stringify(user), "EX", 3600) const cached = await kv.get("user:123") // Rate limiting const count = await kv.incr("ratelimit:api:usr_123") await kv.expire("ratelimit:api:usr_123", 60) // Pub/Sub kv.subscribe("events") kv.on("message", (channel, message) => { console.log(channel, message) }) ``` Open Source Revenue Sharing ### Up to 5% of compute goes back to open source Every deployment is SBOM-verified. Contributors to Valkey earn a share of compute revenue — transparent, on-chain, and customizable by the community. [Connect & Earn](https://hanzo.ai/open-source/dividends)[Learn More](https://hanzo.ai/open-source) Open Source Compute Dividends ### Up to 5% of compute goes back to OSS authors Every Hanzo deployment tracks software dependencies via SBOM. When your code powers compute on Hanzo, the authors get paid — automatically. USDHanzo NetworkETHSOLUSDCmore [Connect GitHub](https://console.hanzo.ai?ref=oss-dividends)[How payouts work](https://hanzo.ai/open-source/dividends) ## Put it in front of the database Free tier includes 256 MB. Provision in seconds. [Get Started](https://docs.hanzo.ai/docs/kv)[View on GitHub](https://github.com/hanzoai/kv) ## Open source License: BSD-3-Clause[hanzoai/kv](https://github.com/hanzoai/kv) ## Get KV Distributed key-value store [Deploy to Cloud](https://console.hanzo.ai/deploy)[Self-host](https://docs.hanzo.ai/docs/kv)