This is an implementation of a mini Redis server as a code challenge. The code consists of modules for handling client connections, defining commands, managing a simple in-memory cache, and utility functions.
- Clone the repository.
- Navigate to the project directory.
- Run
cargo build
to build the project. - Run the resulting binary with
cargo run
.
- Listens for incoming TCP connections on
127.0.0.1:6379
.
- Add new commands: To extend the functionality, add new command handlers in the
Commands
module. - Enhance cache features: Modify the
Cache
module to support additional features like eviction policies.
- Unit tests are provided for the
Cache
andCommands
modules. - Run tests using
cargo test
.
ping
: Responds with "PONG".echo <message>
: Responds with the input message.set <key> <value> [EX <expiry>]
: Sets a key-value pair with an optional expiration time.get <key>
: Retrieves the value associated with the specified key.