Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
Signed-off-by: Omkar Phansopkar <[email protected]>
  • Loading branch information
OmkarPh committed Mar 29, 2024
1 parent d53a936 commit c4fe0d9
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ redis-server-lite

# or

# Using a release archive from https://github.com/OmkarPh/test-redis-server-lite/releases/latest
# Using a release archive from https://github.com/OmkarPh/redis-server-lite/releases/latest
cd ~/Downloads # Go to the Downloads folder of your machine
mkdir redis-server-lite
tar -xf "release_archive_file" -C redis-server-lite
Expand Down
93 changes: 67 additions & 26 deletions Release.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,76 @@

# A Lite redis-server implementation in golang
## A Lite redis-server implementation in golang

### Prerequisites
## Prerequisites
- redis-cli (for testing the implementation)

Installation guide - https://redis.io/docs/install/install-redis/

- Go 1.11 or later

#### Setup
## Try out

```bash
# Clone this repository
$ git clone https://github.com/OmkarPh/redis-lite.git
# Using brew (for mac or linux)
brew install omkarph/tap/redis-server-lite
redis-server-lite

# or

# Go into the server directory
$ cd redis-lite/server/cmd
# Using a release archive from https://github.com/OmkarPh/redis-server-lite/releases/latest
cd ~/Downloads # Go to the Downloads folder of your machine
mkdir redis-server-lite
tar -xf "release_archive_file" -C redis-server-lite
cd redis-server-lite
./redis-server-lite

# Run the server
$ go run .
# Test
redis-cli set message Hello World
redis-cli get message
```

## Supported redis-cli commands

| Command | Syntax | Example | |
|--------- |------------------- |------------------------------ |--- |
| SET | SET <key> <value> | redis-cli SET name Mark | |
| GET | GET <key> | redis-cli GET name | |
| INCR | INCR key | redis-cli INCR age | |
| DECR | DECR key | redis-cli DECR age | |
| EXISTS | EXISTS key [key ...] | redis-cli EXISTS name age | |
| EXPIRE | EXPIRE key seconds | redis-cli EXPIRE name 20 | |
| TTL | TTL key | redis-cli TTL key | |
| DEL | DEL key [key ...] | redis-cli DEL name age | |
| TYPE | TYPE key | redis-cli TYPE name | |
| PING | PING | redis-cli PING | |
| ECHO | ECHO <message> | redis-cli ECHO "Hello world" | |
## Features

- Follows RESP protocol (Works with redis-cli & redis-benchmark)
- Key expiration (Active & Passive)
- Simple & Sharded key-value stores

Can be customised in `redis.conf` file as:
```
kv_store sharded
shardfactor 32
or
kv_store simple
```

## Supported commands

Detailed documentation - https://redis.io/commands/

| Command | Syntax | Example | Description |
|----------|------------------------------------------|-----------------------------------------------------------|-------------------------------------------------|
| SET | SET <key> <value> | redis-cli SET name omkar | Set the string value of a key |
| GET | GET <key> | redis-cli GET name | Get the value of a key |
| DEL | DEL key [key ...] | redis-cli DEL name<br/>redis-cli DEL name age | Delete one or more keys |
| INCR | INCR key | redis-cli INCR age | Increment the integer value of a key |
| DECR | DECR key | redis-cli DECR age | Decrement the integer value of a key |
| EXISTS | EXISTS key [key ...] | redis-cli EXISTS name<br/>redis-cli EXISTS name age | Check if a key exists |
| EXPIRE | EXPIRE key seconds [NX / XX / GT / LT] | redis-cli EXPIRE name 20<br/>redis-cli EXPIRE name 20 NX | Set a key's time to live in seconds |
| PERSIST | PERSIST key | redis-cli PERSIST name | Remove the expiration from a key |
| TTL | TTL key | redis-cli TTL key | Get the time to live for a key (in seconds) |
| TYPE | TYPE key | redis-cli TYPE name | Determine the type stored at a key |
| PING | PING | redis-cli PING | Ping the server |
| ECHO | ECHO <message> | redis-cli ECHO "Hello world" | Echo the given string |


## Benchmarks

```bash
redis-benchmark -t SET,GET,INCR -q
```

### redis-server-lite
![redis-server-lite](assets/benchmarkLite.png)

### Original redis-server
![redis-server](assets/benchmarkOg.png)

0 comments on commit c4fe0d9

Please sign in to comment.