3 ms·
Show HN: JsonDB – A Redis-like KV store with MongoDB query in Go
hi~
i open and start a long-term project to implement a database for gaining a deep understanding of modern database architecture and implementation
this project is an extend project of [go-redis-fallback](https://github.com/pardnchiu/go-redis-fallback https://github.com/pardnchiu/go-redis-fallback), to use same cache skill to build a tcp connection database with aof logging and mongodb-like query features
with projects web-monitor, cim-prototype, rss-reader, im skilled in cmd parse and set action, so the next step is to build my own database for sharing
i already completed these features
Complete Database System Architecture
- TCP Server: Implements a TCP server listening on `127.0.0.1:7989`
- CLI Client: Supports `cli` interaction and command execution mode (`-c` parameter)
- Multi-Database Support: Allows switching and isolated storage for up to 16 databases (0-15)
Basic KV Operation System
- Core Operations: Fully implements `GET`, `SET`, `DEL`, `EXISTS`, `TYPE`
- Pattern Matching: `KEYS` command supports wildcard search with `*` and `?`
- TTL Management: Fully implements `TTL`, `EXPIRE`, `PERSIST`, with automatic expiration cleanup
- Type System: Automatically detects types like `string`, `int`, `object`, `array`
Dual Storage System
- AOF Persistence: Logs commands and supports automatic recovery on startup
- File Caching: MD5 hash-based three-level directory structure (data/0/ab/cd/ef/hash.json)
- JSON Format: Includes `created_at`, `updated_at`, `expire_at`