-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
164e457
commit 1232931
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Rustis | ||
|
||
[![CI](https://github.com/braden-godley/rustis/actions/workflows/test.yml/badge.svg)](https://github.com/braden-godley/rustis/actions/workflows/test.yml) | ||
|
||
Rustis is a Rust-based implementation of a subset of Redis's functionality. It provides an executable that can be used to start a server or issue commands to a server as a client. | ||
|
||
## Installation | ||
|
||
You can install Rustis by downloading this repository, then running the following: | ||
|
||
```sh | ||
cargo install --path . | ||
``` | ||
|
||
This will install the `rustis` binary on your PATH | ||
|
||
## Features | ||
|
||
Right now there are two core services implemented in Rustis's client and server: | ||
- Publisher / Subscriber | ||
- Key / value storage | ||
|
||
## How it works | ||
|
||
The Rustis server listens for TCP connections and parses/validates the packets they send into commands. It uses a pool of threads to handle TCP connections and another pool of threads to handle the publisher/subscriber logic. | ||
|
||
## How to use | ||
|
||
### Starting a server | ||
|
||
To start a server that clients can send commands to, run the following: | ||
|
||
```sh | ||
rustis server | ||
``` | ||
|
||
### Publishing a message to a channel | ||
|
||
```sh | ||
rustis client publish 'channel' 'message' | ||
``` | ||
|
||
### Subscribing to messages on a channel | ||
|
||
```sh | ||
rustis client subscribe 'channel' | ||
``` | ||
|
||
### Setting a value | ||
|
||
```sh | ||
rustis client set 'key' 'value' | ||
``` | ||
|
||
### Setting a value with an expiration TTL | ||
|
||
```sh | ||
rustis client setex 'key' <ttl in seconds> 'value' | ||
``` | ||
|
||
### Getting a value | ||
|
||
```sh | ||
rustis client get 'key' | ||
``` | ||
|
||
### Getting the remaining time of a key | ||
|
||
```sh | ||
rustis client ttl 'key' | ||
``` | ||
|