DEV Community

Cover image for Pythonic Redis
VORG
VORG

Posted on • Updated on

Pythonic Redis

pottery

Star 611 Watch 11 Fork 23

Pottery is a Pythonic way to access Redis. If you know how to use Python dicts, then you already know how to use Pottery.

Pottery is useful for accessing Redis more easily, and also for implementing microservice resilience patterns; and it has been battle tested in production at scale.

>>> from pottery import RedisList
>>> tel = RedisDict({'jack': 4098, 'sape': 4139}, redis=redis, key='tel')
>>> tel['guido'] = 4127
>>> tel
RedisDict{'jack': 4098, 'sape': 4139, 'guido': 4127}
>>> tel['jack']
4098
>>> squares = RedisList([1, 4, 9, 16, 25], redis=redis, key='squares')
>>> squares
RedisList[1, 4, 9, 16, 25]
>>> squares[0]
1
Enter fullscreen mode Exit fullscreen mode

Top comments (0)