summaryrefslogtreecommitdiff
path: root/redis/commands/redismodules.py
diff options
context:
space:
mode:
Diffstat (limited to 'redis/commands/redismodules.py')
-rw-r--r--redis/commands/redismodules.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/redis/commands/redismodules.py b/redis/commands/redismodules.py
new file mode 100644
index 0000000..fb53107
--- /dev/null
+++ b/redis/commands/redismodules.py
@@ -0,0 +1,17 @@
+from json import JSONEncoder, JSONDecoder
+from redis.exceptions import ModuleError
+
+
+class RedisModuleCommands:
+ """This class contains the wrapper functions to bring supported redis
+ modules into the command namepsace.
+ """
+
+ def json(self, encoder=JSONEncoder(), decoder=JSONDecoder()):
+ """Access the json namespace, providing support for redis json."""
+ if 'rejson' not in self.loaded_modules:
+ raise ModuleError("rejson is not a loaded in the redis instance.")
+
+ from .json import JSON
+ jj = JSON(client=self, encoder=encoder, decoder=decoder)
+ return jj