A lightweight, Redis-inspired key-value store written in Java.
- Concurrent connections via Java 21 virtual threads
- Commands:
PING,GET,SET,DEL,EXISTS - Pluggable
Storeinterface for swappable storage backends
- Java 21+
Compile all sources from the project root:
javac -d out shared/*.java server/*.java client/*.javaStart the server (default port 8080):
java -cp out server.ServerOr specify a custom port:
java -cp out server.Server 7379Run the client:
java -cp out client.Client <command> [arguments]| Command | Usage | Description |
|---|---|---|
ping |
ping |
Health check |
set |
set <key> <value> |
Store a value |
get |
get <key> |
Retrieve a value |
delete |
delete <key> |
Remove a key |
exists |
exists <key> |
Check if a key exists |
java -cp out client.Client ping
# OK
java -cp out client.Client set hello world
# OK
java -cp out client.Client get hello
# OK
# world
java -cp out client.Client exists hello
# OK
java -cp out client.Client delete hello
# OK
java -cp out client.Client get hello
# NOT_FOUNDjkey uses a simple binary protocol over TCP.
Request:
[1 byte] command
[4 bytes] key length
[N bytes] key
[4 bytes] value length (SET only)
[M bytes] value (SET only)
Response:
[1 byte] status (OK=0x0, NOT_FOUND=0x1, ERROR=0x2)
[4 bytes] value length (GET only, on OK)
[N bytes] value (GET only, on OK)
- Persistence via write-ahead log (WAL)
- TTL / key expiration
- REPL mode in the client
- Authentication
- Multiple databases