feat: add redis cache

This commit is contained in:
2024-08-21 22:53:50 +03:00
parent 0638fb8d50
commit d3ef03a6a0
19 changed files with 194 additions and 24 deletions

View File

@@ -1,7 +1,6 @@
import datetime
import logging
from aiocache import cached
from bs4 import BeautifulSoup
from gallery.sketch.schedule.api import ScheduleApi
@@ -13,8 +12,8 @@ logger = logging.getLogger("matchtv")
class MatchTvApi(ScheduleApi):
PROVIDER = "matchtv"
SOURCE = ApiSource("https://matchtv.ru")
CACHE_TTL = 30 * 60
async def get_channels(self) -> list[str]:
return [
@@ -27,7 +26,6 @@ class MatchTvApi(ScheduleApi):
ChannelId.MATCH_STRANA,
]
@cached(ttl=CACHE_TTL)
async def get_channel_schedule(
self, channel_id: str, date: datetime.date
) -> Schedule: