def getField(self, key): objectType = self.redis.type(self.key+key) if objectType == "string": # If it's a string then we have to check if it # is a boolean or a regular string since # Redis doesn't have a concept of boolean it seems objectData = self.redis.get(self.key+key) try: objectData = dbu.toBoolean(objectData) except: pass self._data[key] = objectData if objectType == "list": self._data[key] = redisList(self.key+key)
def __init__(self): keys = { key.split(":")[1]:dbu.toBoolean(c.database.redisBucketServer.get(key)) for key in c.database.redisBucketServer.keys("bucket:*:value") } for key in keys: setattr(self, key, keys[key])
def toggle(bucketID): current = dbu.toBoolean(c.database.redisBucketServer.get("bucket:%s:value"%bucketID)) return c.database.redisBucketServer.set("bucket:%s:value"%bucketID, not current)