Skip to content

Get started

Introduction

Klyro is an in-memory database with a familiar Redis interface. Store keys and collections, coordinate workers, publish events, run transactions, and add ranked text or vector retrieval when an application needs it.

Klyro keeps application data in one schema-free keyspace. Strings, lists, hashes, sets, and sorted sets cover common state, cache, queue, counter, and ranking workloads. Transactions, pub/sub, blocking list operations, and key expiry provide the coordination primitives around those data structures.

The server speaks RESP, so existing Redis clients can connect directly. It can write snapshots to disk, enforce a memory limit with configurable eviction, and store optional Memory indexes beside the core data types for keyword, vector, or hybrid retrieval.

What you get

  • Useful data structures. Model values, counters, collections, queues, unique membership, and ranked sets without a schema.
  • Atomic operations. Group commands in transactions and use optimistic locking when an update depends on the current value.
  • Application coordination. Publish events, subscribe to channels, and block workers until queue items arrive.
  • Controlled memory use. Expire keys and records, set a memory ceiling, and choose how Klyro evicts data when it reaches the limit.
  • Restorable snapshots. Save the keyspace to disk and load it when the server starts again.

The shape of it

Use a published package or any RESP client. The same keyspace and command behavior are available from each language.

from klyro_db import Klyro

db = Klyro()
db.set("session:42", "active", ex=900)
db.hset("user:42", mapping={"name": "Ari", "plan": "pro"})
db.lpush("jobs", "generate-report")

status = db.get("session:42")
profile = db.hgetall("user:42")
job = db.brpop("jobs", timeout=5)

Optional ranked retrieval

Memory indexes add three retrieval modes to the same database. The mode is fixed when an index is created, and a mode that cannot serve a query returns an error.

ModeKeywordSemanticNeeds vectors
SEARCHYes, BM25NoNo
VECTORNoYesYes
HYBRID (default)Yes, BM25YesYes

How a fused score is built

Keyword relevance is BM25 over an inverted index. Semantic similarity is the index metric, one of cosine, L2, or inner product. Both are rescaled onto a common range before they are combined, because BM25 is unbounded and cosine is not.

fused score
score = w_keyword·keyword
      + w_vector·vector
      + w_recency·recency
      + w_importance·importance

defaults: 0.35  0.50  0.10  0.05     half-life: 7 days

Recency halves every half-life, so a memory written this morning outranks an equally relevant one from last month. Importance is a value you set per record, which is how a stated preference stays ahead of small talk. Both weights are adjustable per index with MEM.CONFIG and per query with WEIGHTS.

Where ranked retrieval fits

Memory indexes suit thousands to low tens of thousands of records per index. Vector search uses an exact scan bounded by mem-max-scan; larger vector collections need an approximate index, which is planned. See limitations for the full picture before you depend on it.

Next steps