A lightweight and intuitive, in-memory, key-value store available through a TCP connection written in Go.
- SET: Store a key-value pair in the database, with an optional time-to-live (TTL) value (in
Seconds
).- Usage :
SET <key> <value> <ttl>
- Usage :
- GET: Retrieve the value associated with a given key from the database.
- Usage:
GET <key>
- Usage:
- DELETE: Remove a key-value pair from the database.
- Usage:
DELETE <key>
- Usage:
- PING: Health-check endpoint that responds with "PONG"
- Usage:
PING
- Usage:
To get started, follow these steps:
- Install
Go
version1.23
- Clone the repository:
git clone https://github.com/sebastian-nunez/golang-key-value-db
- Start database server:
make run
Once the database server is up and running, you can interact with it using any tcp
client like telnet
or nc
. Here are some examples:
$ nc localhost 3000
$ SET foo bar 300
$ OK ( Server Response )
$ GET foo
$ bar ( Server Response )