示例#1
0
    def get_default_rooms(self) -> list:
        redis_key = RedisKeys.default_rooms()
        value = self.cache.get(redis_key)
        if value is not None:
            return value

        rooms = self.redis.smembers(redis_key)
        if rooms is not None and len(rooms) > 0:
            rooms = [str(room, 'utf-8') for room in rooms]
            self.cache.set(redis_key, rooms, ttl=FIVE_MINUTES)
            return rooms
        return None
示例#2
0
 def clear_default_rooms(self) -> None:
     redis_key = RedisKeys.default_rooms()
     self.cache.delete(redis_key)
示例#3
0
 def set_default_rooms(self, rooms: list) -> None:
     cache_key = RedisKeys.default_rooms()
     self.cache.set(cache_key, rooms, ttl=FIVE_MINUTES)
示例#4
0
文件: redis.py 项目: labrook/dino
 def get_default_rooms(self) -> list:
     self.redis.smembers(RedisKeys.default_rooms())
示例#5
0
文件: redis.py 项目: labrook/dino
 def remove_default_room(self, room_id: str) -> None:
     self.redis.srem(RedisKeys.default_rooms(), room_id)
示例#6
0
文件: redis.py 项目: labrook/dino
 def add_default_room(self, room_id: str) -> None:
     self.redis.sadd(RedisKeys.default_rooms(), room_id)