Overview

FastAPI-Cache 0.2.2, released on July 24, 2024, brings fixes and compatibility improvements.

Main Features

Improvements

Compatibility fixes with latest Redis versions and improved TTL handling and cache invalidation.

python
from fastapi_cache.decorator import cache

# Cache with improved invalidation
@cache(expire=300, namespace='users')
async def get_users():
    return {'users': ['Alice', 'Bob']}

# Namespace-based invalidation
# await FastAPICache.clear(namespace='users')

Sources