A lightweight Redis server implementation in Go that implements the Redis Serialization Protocol (RESP).
Currently supported Redis commands:
PING
- Test server connectionSET key value
- Set a key-value pairGET key
- Get the value of a keyHSET hash field value
- Set a field in a hashHGET hash field
- Get a field from a hashHGETALL hash
- Get all fields and values from a hash
- Go 1.23.5 or later
go run . --port 6379 # Default port is 6379 if not specified
You can then connect to the server using any Redis client, including the official redis-cli
.
- Uses Go's standard library for TCP networking
- Implements basic RESP (Redis Serialization Protocol) parsing and encoding
- Thread-safe operations using sync.RWMutex
- Supports both simple strings and bulk strings in the protocol
- Handles array types for command processing
-
Data Persistence
- Add support for saving data to disk
- Implement Redis RDB-style persistence
- Add AOF (Append Only File) logging
-
Additional Commands
- Add support for Lists (LPUSH, RPUSH, LRANGE, etc.)
- Add support for Sets (SADD, SMEMBERS, etc.)
- Add support for Sorted Sets (ZADD, ZRANGE, etc.)
- Implement expiration for keys (EXPIRE, TTL)
-
Enhanced Features
- Add support for pub/sub messaging
- Implement transactions (MULTI, EXEC, WATCH)
- Add authentication (AUTH command)
- Add database selection (SELECT command)
-
Performance Improvements
- Implement connection pooling
- Add support for pipelining
- Optimize memory usage
- Add benchmarking tools
-
Operational Improvements
- Add proper logging and monitoring
- Implement graceful shutdown
- Add configuration file support
- Add metrics and statistics commands (INFO)
-
Error Handling
- Improve error messages and handling
- Add better validation for commands
- Implement proper timeout handling
Feel free to submit issues and enhancement requests!
MIT License here