Skip to content

How It Works

Each write is applied locally and sent asynchronously to peers found through SunLink, resolving conflicts last-writer-wins on a hybrid logical clock.

Engine

  • SeaWave’s own RESP2/RESP3 server, backed by a concurrent in-memory map with per-key TTL.
  • No disk persistence. Data is lost when the whole replica set restarts, and users then re-authenticate with Redfly.
  • Eviction: keys expire by TTL. Above maxMemoryBytes, the least recently used keys with a TTL are evicted. Keys without a TTL are never evicted, and writes fail with OOM instead.

Replication

  • Peers come from SunLink membership.
  • Every write is applied locally and sent asynchronously to all peers on port 7481 over mTLS.
  • Conflicts resolve last-writer-wins on a hybrid logical clock.
  • A joining peer copies a snapshot from one peer before it serves requests.
  • Guarantee: eventual consistency. A user moving between replicas may need one retry within about one second, which is acceptable for sessions.

Ports

PortBindPurpose
6379127.0.0.1RESP endpoint (Spring Session, deny-list)
7481pod IP, mTLSPeer replication

Supported commands

GroupCommands
Strings and keysGET, SET (with EX/PX/NX/XX), DEL, EXISTS, EXPIRE, PEXPIRE, PEXPIREAT, TTL, PTTL, INCR, INCRBY, RENAME, KEYS, SCAN, TYPE
HashesHGET, HSET, HMSET, HGETALL, HDEL, HEXISTS
SetsSADD, SREM, SMEMBERS
Sorted setsZADD, ZRANGEBYSCORE, ZREM
Pub/subPUBLISH, SUBSCRIBE, PSUBSCRIBE; keyspace notifications cover expiry events
Connection and serverPING, HELLO, SELECT 0, INFO, CONFIG GET, CLIENT SETNAME

Public Kotlin API

MemberPurpose
start()Start the RESP server and replication
get(key) / set(key, value, ttl)Read and write bytes, with an optional TTL
delete(key) / expire(key, ttl)Remove a key or set its TTL
endpoint127.0.0.1:6379

SeaWaveConfig takes bind (default 127.0.0.1), port (6379), replicationPort (7481), an optional sunLink, tls, and maxMemoryBytes (default 256 MB).