core/services/memorycache.py

12 lines
306 B
Python
Raw Normal View History

2024-02-27 12:40:53 +00:00
from dogpile.cache import make_region
2024-03-12 13:18:07 +00:00
from settings import REDIS_URL
2024-02-27 12:40:53 +00:00
2024-03-12 13:18:07 +00:00
# Создание региона кэша с TTL
2024-03-12 14:26:52 +00:00
cache_region = make_region()
cache_region.configure(
2024-04-17 15:32:23 +00:00
"dogpile.cache.redis",
arguments={"url": f"{REDIS_URL}/1"},
2024-03-12 13:18:07 +00:00
expiration_time=3600, # Cache expiration time in seconds
)