def get_past_songs(self, room_id): return self.cache.cache_fetch_fn( redis_key=f"api:queup:past-songs:{room_id}", fetch_fn=lambda: self.fetch_past_songs(room_id), serializer=ListSerializer(QueUpQueueSong), expiry=5, )
def get_past_songs(self, room_id): return self.cache.cache_fetch_fn( redis_key="api:dubtrack:past-songs:{}".format(room_id), fetch_fn=lambda: self.fetch_past_songs(room_id), serializer=ListSerializer(DubtrackQueueSong), expiry=5, )
def get_videos_by_user_id(self, user_id) -> List[TwitchVideo]: return self.cache.cache_fetch_fn( redis_key=f"api:twitch:helix:videos:by-id:{user_id}", fetch_fn=lambda: self._fetch_videos_by_user_id(user_id), serializer=ListSerializer(TwitchVideo), expiry=lambda response: 30 if response is None else 300, )
def get_global_emotes(self, force_fetch=False): return self.cache.cache_fetch_fn( redis_key="api:7tv:global-emotes", fetch_fn=lambda: self.fetch_global_emotes(), serializer=ListSerializer(Emote), expiry=60 * 60, force_fetch=force_fetch, )
def get_channel_emotes(self, channel_name, force_fetch=False): return self.cache.cache_fetch_fn( redis_key=f"api:7tv:channel-emotes:{channel_name}", fetch_fn=lambda: self.fetch_channel_emotes(channel_name), serializer=ListSerializer(Emote), expiry=60 * 60, force_fetch=force_fetch, )
def get_channel_emotes(self, channel_id: str, force_fetch: bool = False) -> List[Emote]: return self.cache.cache_fetch_fn( redis_key=f"api:bttv:channel-emotes:{channel_id}", fetch_fn=lambda: self.fetch_channel_emotes(channel_id), serializer=ListSerializer(Emote), expiry=60 * 60, force_fetch=force_fetch, )