Skip to main content

Simple python interface for redis

Project description,3.5,3.6-blue.svg

Simple python interface for redis


pip install redistore


>> import redistore
>> store = redistore.get(host='localhost', port=6379, db=0)

Now you can access and store keys and values with a dict-like interface:

>> store['foo'] = 'bar'
>> store['foo']
>> 'foo' in store
>> del store['foo']
>> store['foo']
KeyError: 'foo'

Or using methods:

>> store.set('baz', 'qux')
>> store.get('baz')

redistore support other data types, e.g., hashes. they are used exactly like a dict:

>> store['hash'] = {}  # creates a hash without any values
>> 'my' in store['hash']
>> store['hash']['my']
>> store['hash'].update({'baz': 'qux'})
>> store['hash']['baz']
>> len(store['hash'])
>> list(store.keys())
['foo', 'bar']
>> for key, value in store.items():
...    print(key, value)
my hash
baz qux
>> store['other_hash'] = {'foo': 'bar'}  # creates a hash with values
>> store['other_hash']['foo']

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

redistore-0.1.1.tar.gz (3.4 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page