Skip to main content

Extremely simple key-value storage wrapper

Project description

Motivation

I usually use Redis for small projects with a dynamic storage component. Most of the times I just need a very simple key-value storage and Redis does a terrific job with that. However not all the applications need a high performance storage but just being very easy to start using them.

The idea of this wrapper is to start using JSON based storage at the beginning and in the future, if necessary, move the storate of an application to Redis or any other supported driver without changing a single line of code.

Basic usage

JSON store:

import keywrapper

store = keywrapper.new_store(‘json’)

store.set_value(‘foo’, ‘bar’, ‘42’)

store.get_value(‘foo’, ‘bar’)

Redis store:

import keywrapper

store = keywrapper.new_store(‘redis’)

store.set_value(‘foo’, ‘bar’, ‘42’)

store.get_value(‘foo’, ‘bar’)

Migrate from JSON store to Redis store:

import keywrapper

json_store = keywrapper.new_store(‘json’)

redis_store = keywrapper.new_store(‘redis’)

redis_store.restore(json_store.dump())

Current status

These are the current implemented features:

  • JSON and Redis drivers

  • Hash style data type (key, attribute, value)

  • set_value and get_value functions

  • dump function implemented only in JSON driver

  • restore function implemented in both JSON and Redis drivers

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keywrapper-0.1.0.tar.gz (1.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page