mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-11-30 13:20:40 +03:00
wip: cache
This commit is contained in:
@@ -3,6 +3,8 @@ from typing import Annotated
|
||||
from fastapi import APIRouter, Depends, Query
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from fastapi_cache.decorator import cache
|
||||
|
||||
from app.database import get_db
|
||||
from app.models.shakespeare import Paragraph
|
||||
|
||||
@@ -12,6 +14,7 @@ router = APIRouter(prefix="/v1/shakespeare")
|
||||
@router.get(
|
||||
"/",
|
||||
)
|
||||
@cache(namespace="test-2", expire=60)
|
||||
async def find_paragraph(
|
||||
character: Annotated[str, Query(description="Character name")],
|
||||
db_session: AsyncSession = Depends(get_db),
|
||||
|
||||
Reference in New Issue
Block a user