Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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)
Пример #4
0
 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)
Пример #5
0
 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)
Пример #6
0
 def scriptExist(self, script, *moreScripts):
     resp = self.sendCommand(Command.SCRIPT, RedisKeyword.EXISTS, script, *moreScripts)
     return Response.toTuple(resp)
Пример #7
0
 def objectEncoding(self, key):
     resp = self.sendCommand(Command.OBJECT, RedisKeyword.ENCODING, key)
     return Response.toStr(resp)
Пример #8
0
 def renameNX(self, key, newKey):
     resp = self.sendCommand(Command.RENAMENX, key, newKey)
     return Response.toInt(resp) == 1
Пример #9
0
 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)
Пример #10
0
 def pExpireAt(self, key, millTs):
     resp = self.sendCommand(Command.PEXPIREAT, key, str(millTs))
     return Response.toInt(resp) == 1
Пример #11
0
 def randomKey(self):
     resp = self.sendCommand(Command.RANDOMKEY)
     return Response.toStr(resp)
Пример #12
0
 def quit(self):
     resp = self.sendCommand(Command.QUIT)
     return Response.toStr(resp)
Пример #13
0
 def persist(self, key):
     resp = self.sendCommand(Command.PERSIST, key)
     return Response.toInt(resp) == 1
Пример #14
0
 def echo(self, message):
     resp = self.sendCommand(Command.ECHO, message)
     return Response.toStr(resp)
Пример #15
0
 def ping(self):
     resp = self.sendCommand(Command.PING)
     return Response.toStr(resp)
Пример #16
0
 def auth(self, password):
     resp = self.sendCommand(Command.AUTH, password)
     return Response.toStr(resp)
Пример #17
0
 def objectIdletime(self, key):
     resp = self.sendCommand(Command.OBJECT, RedisKeyword.IDLETIME, key)
     return Response.toInt(resp)
Пример #18
0
 def select(self, index):
     resp = self.sendCommand(Command.SELECT, str(index))
     return Response.toStr(resp)
Пример #19
0
 def scriptFlush(self):
     resp = self.sendCommand(Command.SCRIPT, RedisKeyword.FLUSH)
     return Response.toStr(resp)
Пример #20
0
 def flushAll(self):
     resp = self.sendCommand(Command.FLUSHALL)
     return Response.toStr(resp)
Пример #21
0
 def scriptKill(self):
     resp = self.sendCommand(Command.SCRIPT, RedisKeyword.KILL)
     return Response.toStr(resp)
Пример #22
0
 def flushDB(self):
     resp = self.sendCommand(Command.FLUSHDB)
     return Response.toStr(resp)
Пример #23
0
 def pExpire(self, key, millSeconds):
     resp = self.sendCommand(Command.PEXPIRE, key, str(millSeconds))
     return Response.toInt(resp) == 1
Пример #24
0
 def zRevRank(self, key, member):
     resp = self.sendCommand(Command.ZREVRANK, key, member)
     return Response.toInt(resp)
Пример #25
0
 def pTTL(self, key):
     resp = self.sendCommand(Command.PTTL, key)
     return Response.toInt(resp)
Пример #26
0
 def evalSha(self, sha, keyCount, *params):
     resp = self.sendCommand(Command.EVALSHA, sha, keyCount, *params)
     return Response.toTuple(resp)
Пример #27
0
 def rename(self, key, newKey):
     resp = self.sendCommand(Command.RENAME, key, newKey)
     return Response.toStr(resp)
Пример #28
0
 def scriptLoad(self, script):
     resp = self.sendCommand(Command.SCRIPT, RedisKeyword.LOAD, script)
     return Response.toStr(resp)
Пример #29
0
 def eval(self, script, keyCount, *params):
     resp = self.sendCommand(Command.EVAL, script, keyCount, *params)
     return Response.toTuple(resp)
Пример #30
0
 def zScore(self, key, member):
     resp = self.sendCommand(Command.ZSCORE, key, member)
     return Response.toFloat(resp)