core/services/memorycache.py

12 lines
322 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
authors_cache_region = make_region()
authors_cache_region.configure(
'dogpile.cache.redis',
arguments={'url': f'{REDIS_URL}/1'},
expiration_time=3600, # Cache expiration time in seconds
)