Dunena

A high-performance in-memory cache engine built on Zig & Bun

O(1) operations ยท native LRU eviction ยท bloom filter ยท real-time WebSocket streaming ยท Prometheus metrics

Get Started โ†’ API Reference
# Clone and start
git clone https://github.com/owenbellowen/dunena.git
cd dunena
bun run build:zig
bun run start

# Set a value
curl -X POST http://localhost:3000/cache/hello \
  -H "Content-Type: application/json" \
  -d '{"value": "world"}'

# Get it back
curl http://localhost:3000/cache/hello
โšก

Zig-Powered Core

Native O(1) cache operations via hash map + doubly-linked list LRU. Called through Bun's zero-cost FFI bridge.

๐Ÿ”‘

Full CRUD + Batch

GET, SET, DELETE with namespace isolation. Batch mget/mset for efficient multi-key operations.

๐ŸŒธ

Bloom Filter

Probabilistic membership test eliminates unnecessary hash lookups on cache misses. Configurable false-positive rate.

โฑ๏ธ

TTL Expiry

Per-key time-to-live with automatic cleanup. Set a default TTL or override per request.

๐Ÿ“ก

Real-Time WebSocket

Subscribe to cache events. Run get/set/del/mget/mset over WebSocket with namespace and TTL support.

๐Ÿ“Š

Prometheus Metrics

/metrics endpoint with hits, misses, evictions, hit rate, latency percentiles, and uptime.

๐Ÿ–ฅ๏ธ

Admin Dashboard

Built-in web dashboard with live stats, cache operations panel, key scanner, and event log.

๐Ÿ”ง

CLI Tool

Full-featured command-line client: get, set, del, mget, mset, keys, stats, bench โ€” with namespace support.

๐Ÿ—œ๏ธ

Transparent Compression

Auto-compress large values using native Zig RLE. Configured via threshold โ€” zero-change reads.

Architecture

Client โ”€โ”€HTTP/WSโ”€โ”€โ–ถ Bun Server โ”€โ”€FFIโ”€โ”€โ–ถ Zig Cache Core
                  โ”‚
                  โ”œโ”€โ”€ Router โ†’ Middleware (CORS, Auth, Rate Limit)
                  โ”œโ”€โ”€ CacheService โ†’ NativeCache (LRU, Bloom, Compression)
                  โ”œโ”€โ”€ PubSub โ†’ WebSocket Broadcast
                  โ””โ”€โ”€ Analytics โ†’ Stats, Latency, Prometheus