项目作者: NFhbar

项目描述 :
Memcached, sqlite3 and Python
高级语言: Python
项目地址: git://github.com/NFhbar/tenant-base.git
创建时间: 2019-01-09T21:27:05Z
项目社区:https://github.com/NFhbar/tenant-base

开源协议:MIT License

下载


Tenant Base Backend

CircleCI
Coverage Status

Simple key-value storage which implements a small subset of the memcached protocol.
Data is persisted through SQLite.

Requirements

Installation

In your local machine, clone this repo then create a new virtualenv:

  1. $ git clone git@github.com:NFhbar/tenant-base.git
  2. $ cd tenant-base
  3. $ mvirtualenv tenant-base

If there are issues with python version you can force 3.6 by using:

  1. $ mkvirtualenv --python=`which python3` tenant-base

Install the requirements:

  1. (tenant-base) $ pip install -r requirements.txt

Usage

To print the help menu:

  1. (tenant-base) $ python3 main.py -h

The program assumes that there is a database.sqlite file in root. If it does not exist the program will create it along with a key_value table.

To view all existing key-value pairs:

  1. (tenant-base) $ python3 main.py -sh database.sqlite

To enter the memcached-interface:

  1. (tenant-base) $ python3 main.py -s database.sqlite

The interface options are:

  1. Interface options:
  2. - set key value exptime
  3. - get key
  4. - delete key
  5. - exit

Note: exptime is the expiration time for the key-value pair. This value is ignored.

Unit Tests

To run the unit tests:

  1. (tenant-base) $ python3 -m pytest --cov-report term-missing --cov=main tests/ -s

Pylint

Pylint is configured through .pylintrc.

To run:

  1. (tenant-base) $ pylint main.py

Contact

Nicolas Frega

frega.nicolas@gmail.com