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
# Clone and start
git clone https://github.com/powencu/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
│
├── Router → Middleware (CORS, Auth, Rate Limit)
├── CacheService → NativeCache (LRU, Bloom, Compression)
├── PubSub → WebSocket Broadcast
└── Analytics → Stats, Latency, Prometheus