/pyredis

A python api to interact with redis .It implements all redis data structures and method.

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

pyredis

A python api to interact with redis .It implements all redis data structures and method. Useful to seperate calling redis connection to each place in any projects .

How to Use :

import SmartCache object into your file.

>>>from smartcache.redis_communicator import SmartCache

1 : hset :

>>>cache = SmartCache()
>>>cache[('test', 'key'] = "value"
>>>True

2 : hget

>>>cache = SmartCache()
>>>out = cache[('test', 'key')]
>>>'value'

3 : exists

>>>cache = SmartCache()
>>>'test' in cache
>>>True

4 : hexists

>>>cache = SmartCache()
>>>('test', 'key') in cache
>>>True

5 : sadd and smembers

>>>cache = SmartCache()
>>>cache['one'] = 'data'   # sadd
>>>cache['one']            # smembers
>>>(['data'])
>>>cache['one'] = 'data1'  #sadd
>>>cache['one']            # smembers
>>>set(['data', 'data1'])