def restore(self, key, serialValue, millTTL, replace): if replace : resp = self.sendCommand(Command.RESTORE, key, str(millTTL), serialValue, RedisKeyword.REPLACE) return Response.toStr(resp) else: resp = self.sendCommand(Command.RESTORE, key, str(millTTL), serialValue) return Response.toStr(resp)
def scan(self, cursor, params): args = (str(cursor),) if params != None: args = args + params.getParams() resp = self.sendCommand(Command.SCAN, *args) return Response.toScanResult(resp)
def bitCount(self, key, start, end): args = [key] if start != None: args.append(str(start)) if end != None: args.append(str(end)) resp = self.sendCommand(Command.BITCOUNT, *tuple(args)) return Response.toInt(resp)
def zUnionStore(self, destKey, params, key, *moreKeys): args = (destKey,) numberKeys = 1 + len(moreKeys) args += (numberKeys, key) args += moreKeys if params != None: args += params.getParams() resp = self.sendCommand(Command.ZUNIONSTORE, *args) return Response.toInt(resp)
def sort(self, key, params, destKey): args = [] args.append(key) if params != None: args += params.getParams() if destKey != None: args.append(RedisKeyword.STORE) args.append(destKey) resp = self.sendCommand(Command.SORT, *tuple(args)) return Response.toTuple(resp)
def scriptExist(self, script, *moreScripts): resp = self.sendCommand(Command.SCRIPT, RedisKeyword.EXISTS, script, *moreScripts) return Response.toTuple(resp)
def objectEncoding(self, key): resp = self.sendCommand(Command.OBJECT, RedisKeyword.ENCODING, key) return Response.toStr(resp)
def renameNX(self, key, newKey): resp = self.sendCommand(Command.RENAMENX, key, newKey) return Response.toInt(resp) == 1
def zScan(self, key, cursor, scanParams): args = (key, cursor) if scanParams != None: args += scanParams.getParams() resp = self.sendCommand(Command.ZSCAN, *args) return Response.toScoreMemberScanResult(resp)
def pExpireAt(self, key, millTs): resp = self.sendCommand(Command.PEXPIREAT, key, str(millTs)) return Response.toInt(resp) == 1
def randomKey(self): resp = self.sendCommand(Command.RANDOMKEY) return Response.toStr(resp)
def quit(self): resp = self.sendCommand(Command.QUIT) return Response.toStr(resp)
def persist(self, key): resp = self.sendCommand(Command.PERSIST, key) return Response.toInt(resp) == 1
def echo(self, message): resp = self.sendCommand(Command.ECHO, message) return Response.toStr(resp)
def ping(self): resp = self.sendCommand(Command.PING) return Response.toStr(resp)
def auth(self, password): resp = self.sendCommand(Command.AUTH, password) return Response.toStr(resp)
def objectIdletime(self, key): resp = self.sendCommand(Command.OBJECT, RedisKeyword.IDLETIME, key) return Response.toInt(resp)
def select(self, index): resp = self.sendCommand(Command.SELECT, str(index)) return Response.toStr(resp)
def scriptFlush(self): resp = self.sendCommand(Command.SCRIPT, RedisKeyword.FLUSH) return Response.toStr(resp)
def flushAll(self): resp = self.sendCommand(Command.FLUSHALL) return Response.toStr(resp)
def scriptKill(self): resp = self.sendCommand(Command.SCRIPT, RedisKeyword.KILL) return Response.toStr(resp)
def flushDB(self): resp = self.sendCommand(Command.FLUSHDB) return Response.toStr(resp)
def pExpire(self, key, millSeconds): resp = self.sendCommand(Command.PEXPIRE, key, str(millSeconds)) return Response.toInt(resp) == 1
def zRevRank(self, key, member): resp = self.sendCommand(Command.ZREVRANK, key, member) return Response.toInt(resp)
def pTTL(self, key): resp = self.sendCommand(Command.PTTL, key) return Response.toInt(resp)
def evalSha(self, sha, keyCount, *params): resp = self.sendCommand(Command.EVALSHA, sha, keyCount, *params) return Response.toTuple(resp)
def rename(self, key, newKey): resp = self.sendCommand(Command.RENAME, key, newKey) return Response.toStr(resp)
def scriptLoad(self, script): resp = self.sendCommand(Command.SCRIPT, RedisKeyword.LOAD, script) return Response.toStr(resp)
def eval(self, script, keyCount, *params): resp = self.sendCommand(Command.EVAL, script, keyCount, *params) return Response.toTuple(resp)
def zScore(self, key, member): resp = self.sendCommand(Command.ZSCORE, key, member) return Response.toFloat(resp)