Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Implements a wrapper for Redis datatypes so they mimic the datatypes found in Python.
Python
Branch: master

This branch is 1 commit ahead, 45 commits behind Doist:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
redis_wrap
test
README.markdown
setup.py

README.markdown

Python wrapper for Redis datatypes

Implements a wrapper for Redis datatypes so they mimic the datatypes found in Python.

Requires Redis 2.0+ and newest version of redis-py.

For best performance the wrappers are lazy and use direct Redis calls. E.g. len of list wrapper is implemented by calling llen.

redis-py can be downloaded from here: redis-py on github

Quick install from PyPi:

$ sudo easy_install redis_wrap

Examples

Example of list wrapper:

bears = get_list('bears')
bears.append('grizzly')
assert len(bears) == 1
assert 'grizzly' in bears

Example of hash wrapper:

villains = get_hash('villains')
assert 'riddler' not in villains

villains['riddler'] = 'Edward Nigma'
assert 'riddler' in villains

assert len(villains.keys()) == 1

del villains['riddler']
assert len(villains) == 0

Example of set wrapper:

fishes = get_set('fishes')
assert 'nemo' not in fishes

fishes.add('nemo')
assert 'nemo' in fishes

for item in fishes:
    assert item == 'nemo'
Something went wrong with that request. Please try again.