Code Monkey home page Code Monkey logo

kv-store-rs's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.