GithubHelp home page GithubHelp logo

xmp-er / redis_go Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 8.36 MB

Implementation of Redis 0.1 in Golang, exposed via TCP server allowing multiple connection to connect to same in-memory database with original Redis 0.1 commands

License: MIT License

Go 100.00%
go golang redis redisgo

redis_go's Introduction

sd

REDIS 0.1 EXPOSED VIA TCP SERVER IN GO

Introduction

Redis 0.1, entirely built in Go and exposed via a TCP server, features in-memory storage capabilities. The program accepts database commands from the client connections and processes them, creating in-memory database structures. The output is then displayed both on the standard output stream and to the connected clients.

How to Run and Connect to the Server

  • Clone the repository and run the program using go run ./process from the 'process' folder.
  • Connect to the default server at port 8000 using telnet localhost 8000.
  • For a custom port, use the following command: go run ./process -p :<custom_port>.

Supported Commands

Redis 0.1 supports basic CRUD commands:

  • SET <k> <v>: Set the key to a specified value, if the value, has spaces, then it must be enclsed in quotes as SET sample_key "spaced value".
  • GET <k>: Retrieve the value of a previously set key.
  • DELETE <k>: Delete a key if present.

Arithmetic operation commands include:

  • INCR <k>: Increment the value of a specified key by 1 (if it's an integer), sets new key with default value of "1" if key not present.
  • INCRBY <k> <v>: Increment the value of a specified key by v (if it's an integer), gives error if key not present.

Commands for executing multiple instructions at once:

  • MULTI: Start queuing commands.
  • EXEC: Execute the queued commands.
  • DISCARD: Discard the queued commands.

Additional commands:

  • COMPACT: Display the final SET value of a key if the value was an integer.

Database Structure

Redis features databases indexed from 0 to 15. After connection establishment, select a database to operate on using:

  • SELECT <db_number>: Select a database ranging from 0 to 15 based on the provided number.

Disconnecting from the Server

To terminate an established connection, use the DISCONNECT command, which will terminate the connection from the client-side.

Demonstration Video

A video demonstrating the application, showcasing various commands executed over multiple TCP connections communicating with the same in-memory database simultaneously, can be found here.

Redis_0.1_Go_Demo.mp4

redis_go's People

Contributors

xmp-er avatar

Stargazers

 avatar

Watchers

 avatar

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.