Code Monkey home page Code Monkey logo

redis_like's Introduction

Introduction

Repository made to simulate a simple redis operation. There are 2 base files:

  1. redis_like.py with a class called Redis inside, with limited functionalities.
  2. main.py, to generate a user interface via console to manage this Redis class

How to execute locally

cd {path_to_proejct}

python3 main.py

Commands formats

As asked by the stakeholders of this repository, the commands via console are limited to:

GET <key>

SET <key><value>

UNSET <key>

NUMEQUALTO <value>

END

BEGIN

COMMIT

ROLLBACK

It's important to ensurue this format, with upper case on function and same whitespaces to work properly. Further upgrades can be done to turn into user friendly console.

Examples

SET <a1><123>

NUMEQUALTO <a1>

GET <a1>

END

Class functions

  • get(key)

  • set(key, value)

  • unset(key)

  • num_equal_to(key)

  • begin()

  • commit()

  • rollback()

Tests considerations

Unit tests

Unit tests could be done using pytest tool, executing isolated Redis class functions with valid inputs to ensure the expected outputs.

Integration tests

Chain of calls could be done on differents Redis class functions to ensure data flow, could be used pytest also

Functional tests

A robot could be built to test the console interface main.py, testing invalid and valid inputs to ensure the file works properly. could be used PyUserInput to simulate those events, since needs a console handler. If was web app, Selenium webdrive could be used. I have a repository with this tool to create a robot to play a game, the repository is "aow_auto_clicker", go check it out!

Logic considerations

Inputs

  • considering that wont have any '<' or '>' in paramter value, just as param delimiter
  • considering all inputs will be user input raw data, as string

Storage type

for redis storage I choose dict as storage type, becouse:

  • No persistence needed

  • Almost instantaneous transactions(insert/delete/update)

  • Almost instantaneous access by keys

Exceptions

Due to the simplicity of the implementation and lack of development time, exceptions threatment wasn't made. User input is already being validated with regex pattern, what will ensure it's usability via console

redis_like's People

Contributors

mcbsf 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.