own-redis is a lightweight in-memory key-value store that operates using the UDP protocol. It supports basic database operations: SET
, GET
, and PING
, enabling fast data retrieval and storage.
- TCP/IP & UDP Protocol
- Basic Networking Concepts
- Key-Value Database Implementation
- Fast In-Memory Storage: Data is stored in RAM for quick access.
- UDP-Based Communication: Each request and response is a single UDP packet.
- Thread-Safe: Uses Go's
sync
package to handle parallel requests. - Command Case-Insensitivity: Accepts
PING
,ping
, andPing
as equivalent commands. - Expiring Keys:
SET
supports an optional PX (expiry in milliseconds) flag.
$ go build -o own-redis .
$ ./own-redis --port 8080
$ ./own-redis --help
Own Redis
Usage:
own-redis [--port <N>]
own-redis --help
Options:
--help Show this screen.
--port N Port number.
Verifies if the server is running.
$ nc 0.0.0.0 8080
PING
PONG
Stores a key-value pair.
$ nc 0.0.0.0 8080
SET foo bar
OK
Supports expiration:
SET foo bar PX 10000
Retrieves a stored value.
$ nc 0.0.0.0 8080
GET foo
bar
If key doesn’t exist:
GET unknown_key
(nil)
- Must adhere to
gofumpt
formatting. - No third-party packages allowed.
- Must handle errors gracefully (no panics).
MIT License