A high-performance, in-memory Key-Value cache built with Node.js & TypeScript, supporting multiple eviction policies, lazy TTL expiration, and Redis-inspired persistence (AOF & AOF Rewrite).
Designed to explore core cache internals and system design fundamentals.
- 📑 Table of Contents
- ⭐ Features
- 🔮 Future Additions
- 🛠 Tech Stack
- 🧩 Architecture Overview
- 🧠 Eviction Policies
- ⏱ TTL (Time-To-Live)
- 💾 Persistence
- Setup And Installation
- 🧭 Roadmap
- 📄 License
- 🤝 Contributing
- ⭐ Show Your Support
✔ In-memory Key-Value store
✔ Configurable memory limit (bytes-based)
✔ Multiple eviction policies
✔ Lazy TTL expiration
✔ Append-Only File (AOF) persistence
✔ AOF Rewrite (compaction)
✔ Modular, pluggable architecture
✔ Dockerized for local testing
- Active TTL expiration (background cleaner)
- Snapshot-based persistence
- Replication support
- Sharding & partitioning
- Metrics & observability
- Networked cache protocol (Redis-like)
Node.js • TypeScript • Docker
- Core storage uses an in-memory
Map - Eviction & persistence are pluggable components
- TTL is enforced on access (lazy expiration)
Kvotis supports multiple eviction strategies, configurable at runtime.
- Evicts the key that has not been accessed recently
- Updated on every
GETandSET - Commonly used in production caches
- Evicts the key with the lowest access frequency
- Suitable for workloads with hot keys
- Evicts keys in insertion order
- Simple and predictable
- Cache throws OOM error when memory limit is reached
- Useful for testing and strict memory enforcement
Kvotis uses lazy TTL expiration.
- Each key can have an optional TTL
- Expiration timestamp is stored with the value
- TTL is checked only on access (
GET)
- Expired keys are removed when accessed
- Prevents unnecessary background CPU usage
- Ensures correctness without active scanning
This mirrors Redis’s lazy expiration strategy (partial implementation).
Kvotis implements Redis-inspired persistence mechanisms.
- Every mutating operation (
SET,DELETE) is appended to a log - On restart, cache state is reconstructed by replaying the log
- Guarantees durability of writes
- Periodically rewrites the AOF file
- Removes redundant commands
- Keeps only the minimal command set to rebuild current state
- Prevents unbounded AOF growth
git clone https://github.com/Anshikakalpana/kvotis
docker compose up --build
npm run start
-
Active TTL expiration
-
Snapshot persistence
-
Replication
-
Metrics endpoint
-
Network protocol support
MIT License — free for personal & commercial use.
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐️ if this project helped you!
Made with ❤️ by Anshika Kalpana