own-redis — is a high-performance key-value storage using the UDP protocol to interact with clients.
- Go 1.20 and above.
First clone the repository and compile the project:
git clone <repository_url>
cd own-redis
go build -o own-redis .To start the server, use the following command:
./own-redis -port 7070-port N: Sets the port on which the server will run.-help: Print usage information.
The PING command is used to check whether the server is running.
$ nc 0.0.0.0 8080
PING
PONGThe SET command stores a key-value pair.
$ nc 0.0.0.0 8080
SET Foo Bar
OKIf the PX option is specified, the key-value pair will expire after the specified milliseconds.
$ nc 0.0.0.0 8080
SET foo bar px 10000
OKThe GET command retrieves the value associated with a key.
$ nc 0.0.0.0 8080
SET Foo Bar
OK
GET Foo
BarIf the key does not exist, the server should return (nil).
$ nc 0.0.0.0 8080
GET RandomKey
(nil)If a command does not have the correct number of arguments, return an error:
(error) ERR wrong number of arguments for 'SET' command