Bundis – Bun.RedisClient के लिए SQLite-आधारित Redis-संगत सर्वर
(github.com/Munsunty)यह उन प्रोजेक्ट्स के लिए है जहाँ Bun ऐप में Redis-स्टाइल API और pub/sub चाहिए, लेकिन अलग Redis सर्वर चलाना नहीं चाहते।
बस साधारण Bun.RedisClient का connection URL इस सर्वर की ओर कर दें, और कोड बदले बिना यह वैसे ही काम करता है। Redis इंस्टॉल करने की ज़रूरत नहीं, और कोई native dependency भी नहीं है। डेटा SQLite फ़ाइल (WAL) में persist होता है, इसलिए restart के बाद भी बना रहता है, और read operations in-memory hot cache से तेज़ हो जाती हैं।
मुख्य बातें
- 0 dependencies —
bun:sqlite,Bun.listenदोनों Bun में built-in हैं। अलग से इंस्टॉल की ज़रूरत नहीं - persistence — डेटा SQLite की एक single file में store होता है, restart के बाद भी बना रहता है
- cold start ~13ms — डेटा के आकार से स्वतंत्र (Redis के RDB/AOF replay के विपरीत, startup पर डेटा replay नहीं होता)
- hot cache — write-through + adaptive idle eviction + LRU byte cap. Cache सिर्फ read acceleration के लिए है, और SQLite हमेशा source of truth है
- 3 execution modes — process के भीतर embed / sidecar spawn / standalone daemon (
bunx)
उपयोग उदाहरण
import { RedisClient } from "bun";
import { embedServer } from "bundis";
const server = embedServer({ dbPath: "./data.db" });
const client = new RedisClient(server.url);
await client.set("k", "v");
जो स्पष्ट रूप से लक्ष्य नहीं हैं
- Bun के अलावा दूसरे runtimes (Node.js/Deno आदि) और Bun.RedisClient के अलावा दूसरे clients (
ioredis,node-redis,redis-pyआदि) supported नहीं हैं। Wire contract ("अगर सही bytes आएँ, तो सही bytes में जवाब मिले") ही guarantee के दायरे में है - Redis Cluster/Sentinel, multi-process
.dbsharing, HA/failover इस दायरे में नहीं हैं (single writer मानकर) - Lua scripting (
EVAL), list/sorted-set command समूह अभी implement नहीं हैं (योजना में हैं)
लक्ष्य interface compatibility है, Redis performance clone बनाना नहीं। Throughput में Redis आगे है; Bundis का मूल्य यह है कि यह "Redis इंस्टॉल किए बिना Bun में disk persistence + Redis API" देता है। Performance metrics असली Bun.RedisClient के साथ loopback TCP पर measured compatibility-path benchmarks हैं, और methodology तथा before/after numbers repository के PERFORMANCE.md में सार्वजनिक हैं।
GitHub: https://github.com/Munsunty/bundis
इंस्टॉल: bun add bundis
अभी कोई टिप्पणी नहीं है.