From 9c21b43ba5c19d2df7c1b69bf5a96ec1d8df7ea6 Mon Sep 17 00:00:00 2001 From: moneromooo Date: Sun, 11 Jan 2015 22:32:18 +0000 Subject: [PATCH] Add exists and delete redis trampolines --- tipbot/redisdb.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tipbot/redisdb.py b/tipbot/redisdb.py index 78ae579..8b78a00 100644 --- a/tipbot/redisdb.py +++ b/tipbot/redisdb.py @@ -28,6 +28,9 @@ def connect_to_redis(host,port): def redis_pipeline(): return redisdb.pipeline() +def redis_exists(k): + return redisdb.exists(k) + def redis_get(k): return redisdb.get(k) @@ -52,12 +55,16 @@ def redis_hincrby(t,k,v): def redis_incrby(k,v): return redisdb.incrby(k,v) +def redis_delete(k): + return redisdb.delete(k) + def CompatibilityCheck(): try: r = redis.Redis() if not r.pipeline: raise RuntimeError('pipeline call not found') p = r.pipeline() + if not p.exists: raise RuntimeError('exists call not found') if not p.get: raise RuntimeError('get call not found') if not p.set: raise RuntimeError('set call not found') if not p.hexists: raise RuntimeError('hexists call not found') @@ -67,6 +74,7 @@ def CompatibilityCheck(): if not p.hincrby: raise RuntimeError('hincrby call not found') if not p.incrby: raise RuntimeError('incrby call not found') if not p.execute: raise RuntimeError('execute call not found') + if not p.delete: raise RuntimeError('delete call not found') except Exception,e: log_error('Error checking redis compatibility: %s' % str(e)) exit(1)