Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sreehari2003/kv-redis

Key Value DB redis implementation in golang - Support GET,SET,DELETE commands
https://github.com/sreehari2003/kv-redis

go golang redis redis-client

Last synced: 7 days ago
JSON representation

Key Value DB redis implementation in golang - Support GET,SET,DELETE commands

Awesome Lists containing this project

README

        

## Key value pair db like redis implementation in golang

## Completly inspired from ONE2N golang playbook

```
https://playbook.one2n.in/key-value-db-redis-exercise#714257b1224c462aa936497aa2261671
```

- implementing a small subset of Redis commands. We’ll focus on the following features:
- It will be reachable over TCP
- It can handle concurrent clients. That is, it can accept connections from multiple clients and responds to them regardless of the order in which they connect and send requests. For instance, client C1 connects, client C2 connects, C2 can send a request and get a response no matter what C1 is doing, whether staying idle, disconnecting or sending requests as well.
- The following will be implemented:
- `GET`: Accepts a string, and return the value stored for that key, if any
- `SET`: Accepts two strings, a key and a value, and sets the value for the key, overriding any values that may have been present
- `DEL`: Accepts a string and deletes the value that may have been there
- `INCR`: Accepts a single argument and increments the existing value. If the value is not an integer, it’s an error, if there are no values, it gets initialized to `1`, resulting in an identical outcome as calling `SET 1`.

### How to run the code ?

```bash
go run main.go 8080
```
#### In another port run - make sure that telnet is installed

```bash

telnet localhost 8080
```