Skip to content

Caching is not working on routes that are generated from a factory function #491

Description

@jjmurre

My router is generate from a factory function like this:

def api_router_factory(prefix, schema, model):
    router = APIRouter(prefix=prefix, responses={404: {"description": "Not found"}})
    router.get("/", response_model=list[schema])(
        cache(expire=100)(
            multi_fetch_router_factory(multi_fetch_crud_factory(model))
        )
    )
    return router

However, the cache is never HIT.
I also tried adding explicit return types to the functions that are generated in the factory functions (multi_fetch_router_factory and multi_fetch_crud_factory), but that does not help.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions