Skip to content
vennictusPublic

About

a redis implementation but in go

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

32 Commits

Folders and files

Repository files navigation

Blueis

A compact Redis-compatible cache written in Go, with strings, hashes, TTL, Pub/Sub, persistence, a custom replication stream, and memory eviction.

Blueis implements a focused RESP2 command subset. It is useful for local cache workflows and for studying how a cache server works. Redis Cluster, Sentinel, failover, authentication, TLS, Lua, and Redis's replication handshake are outside its scope.

Start in two terminals

Requires Go 1.25.0 or newer. redis-cli is optional for the examples.

go run ./cmd/blueis
redis-cli -p 6380
PING
SET greeting "hello from Blueis"
GET greeting
HSET user:1 name Ishjaap role builder
HGET user:1 role
INCR visits
SET session:1 active EX 30
TTL session:1
INFO memory

On Windows, ./scripts/run.ps1 starts the server and ./scripts/demo.ps1 runs an isolated demo using randomly prefixed keys, then removes those keys.

What is included

  • Binary-safe strings and hashes; multi-key reads/writes; integer counters.
  • Key expiry with absolute deadlines preserved across new persistence records.
  • Transactions that hide pending writes and roll back on failed durable commits.
  • Synced, checksummed AOF state records and checksummed snapshot files.
  • Exact recorded eviction results with noeviction, LRU, and LFU policies.
  • Pub/Sub, MONITOR, and resumable Blueis replication with bounded buffers.
  • INFO section selection and COMMAND metadata.
  • Configurable client limits, idle timeouts, write timeouts, and graceful shutdown.

Blueis architecture

Defaults and configuration

Setting Default
Address 127.0.0.1:6380
AOF data/appendonly.aof
Snapshot data/snapshot.json
Snapshot interval / writes 60s / 1000
Maximum connected clients 1024
Client read idle timeout 5m
Client write timeout 10s
Maximum estimated memory Unlimited
Eviction policy noeviction
go run ./cmd/blueis -addr 127.0.0.1:6380 -maxclients 256 -idle-timeout 10m -write-timeout 5s

Use -aof= or -snapshot= to disable that persistence mechanism. Use zero for client limits/timeouts or snapshot scheduling settings to disable that limit, timeout, or trigger. Negative settings are rejected.

The default binds loopback. Binding :6380 exposes the unauthenticated server on all interfaces; use a trusted network if you choose that configuration.

Test and build

go test ./...
go test -race ./...
go vet ./...
go build ./cmd/blueis

Windows helpers: ./scripts/test.ps1 and ./scripts/build.ps1. Tests need local TCP and file replacement access. The test helper runs every package, runs vet, and exits on failure.

CI runs tests and builds on Linux and Windows, Linux race detection, formatting, and a comparison suite against Redis 7.4. To run the comparison locally:

BLUEIS_REDIS_ADDR=127.0.0.1:6379 go test ./internal/server -run TestRedisCompatibility -v

The comparison uses unique test keys and removes them afterward. On PowerShell, set $env:BLUEIS_REDIS_ADDR before running the Go command.

Documentation

License

MIT, copyright 2026 Ishjaap Singh. The license text follows the Open Source Initiative MIT template.

About

a redis implementation but in go

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages