Skip to content

Instantly share code, notes, and snippets.

@agentspawn
agentspawn / aiorejson.py
Created May 25, 2020 01:46
RedisJSON for aioredis
class ReJSON:
def __init__(self, _redis):
self.redis = _redis
async def set(self, key, path, jsonable, nx=False, xx=False):
"""
Set the JSON value at ``key`` under the ``path`` to ``jsonable``
``nx`` if set to True, set ``value`` only if it does not exist
``xx`` if set to True, set ``value`` only if it exists
"""