Skip to content

vijith07/kv-store-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Key-Value Store

A simple key-value store written in rust using the tokio runtime.

Table of Contents

How to use this app

Prerequisites

  • rust installed on your machine

Installation

  • Clone this repo to your local machine using git clone
  • cd into the repo
  • Install dependencies using cargo install

Usage

  • Run the app using cargo run
  • Build the app using cargo build

How it works

This app uses the tokio runtime to handle asynchronous tasks. The tokio runtime is a low-level, zero-cost abstraction over futures. It provides several tools to help you write asynchronous code, including:

  • The tokio::spawn function for executing a future on a thread pool
  • Asynchronous versions of common std types, including TCP streams (tokio::net::TcpStream), UDP sockets (tokio::net::UdpSocket), and channels (tokio::sync::mpsc and tokio::sync::oneshot)
  • The tokio::sync::Mutex type, an asynchronous version of std::sync::Mutex
  • Timer types, including tokio::time::Instant and tokio::time::Duration
  • The tokio::main macro, which makes it easy to run a tokio application

This app is a simple key-value store that allows you to set, get, and delete keys. It uses the redis protocol to communicate with the redis-cli. The redis-cli is a command line interface for redis that allows you to interact with the redis server. The redis-cli is a simple program that allows you to send commands to the server and read the replies sent back.

The redis protocol is a text-based protocol that uses the client-server model. The client sends a command to the server and the server responds with a reply. The client and server communicate using a TCP connection. The client sends a command to the server and the server responds with a reply. T

Commands

Command Description
redis-cli set key value Set a key
redis-cli get key Get a key
redis-cli set key value ex time Set an expiration time for a key
redis-cli ttl key Get the remaining time for a key
redis-cli del key Delete a key
redis-cli flush Delete all keys

Examples

Command Description
redis-cli set name john Set the key name to the value john
redis-cli get name Get the value of the key name
redis-cli set name john ex 10 Set the key name to the value john and set an expiration time of 10 seconds
redis-cli ttl name Get the remaining time for the key name
redis-cli del name Delete the key name
redis-cli flush Delete all keys

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published