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
def clear_default_rooms(self) -> None: redis_key = RedisKeys.default_rooms() self.cache.delete(redis_key)
def set_default_rooms(self, rooms: list) -> None: cache_key = RedisKeys.default_rooms() self.cache.set(cache_key, rooms, ttl=FIVE_MINUTES)
def get_default_rooms(self) -> list: self.redis.smembers(RedisKeys.default_rooms())
def remove_default_room(self, room_id: str) -> None: self.redis.srem(RedisKeys.default_rooms(), room_id)
def add_default_room(self, room_id: str) -> None: self.redis.sadd(RedisKeys.default_rooms(), room_id)