Skip to main content

Make python objects persistent with Redis.

Project description

Build Status

Persistent python objects with Redis backend.

pip install rob

JsonObject

An object that does a JSON dump of the dictionary and save it in a Redis hash.

Needs to define HASH_KEY - the key to the hash.

HashObject

An object that saves its dictionary in a Redis hash. Using the HMSET. It uses a list to keep track of saved objects.

Needs to define HASH_KEY - a key that is used as prefix to the list and as the key to the hash.

Mixins

The mixins below will work with all the object types.

Autosave mixin

A mixin that calls save every time an attribute is set.

Examples

Simple object

from redis import Redis


class ExampleObject(JsonObject):
    HASH_KEY = 'exampleobject'
    redis = Redis()

Autosave object

from redis import Redis


class ExampleAutosaveObject(JsonObject, AutosaveMixin):
    HASH_KEY = 'exampleobject'
    redis = Redis()

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

rob-0.3.0.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

rob-0.3.0-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

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