diff --git a/tests/live_test.py b/tests/live_test.py index 357f380..7006be6 100644 --- a/tests/live_test.py +++ b/tests/live_test.py @@ -94,3 +94,13 @@ def cache_invalid_type(request: Request, response: Response) -> logging.Logger: logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) return logger + + +@app.get("/cache_with_args/{user}") +@cache_one_hour(tag="user_tag") +def cache_with_args(user: int) -> dict[str, Union[bool, str]]: + """Have a varying cache key based on the user argument.""" + return { + "success": True, + "message": f"this data is for user {user}", + } diff --git a/tests/main.py b/tests/main.py index 4f18b4f..97784ae 100644 --- a/tests/main.py +++ b/tests/main.py @@ -63,3 +63,13 @@ def cache_invalid_type(request: Request, response: Response) -> logging.Logger: logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) return logger + + +@app.get("/cache_with_args/{user}") +@cache_one_hour(tag="user_tag") +def cache_with_args(user: int) -> dict[str, Union[bool, str]]: + """Have a varying cache key based on the user argument.""" + return { + "success": True, + "message": f"this data is for user {user}", + }