From 375e611e50b7d2780e8d7007455b48453c9ba4b3 Mon Sep 17 00:00:00 2001 From: Jordan Cook Date: Tue, 3 May 2022 15:11:54 -0500 Subject: Add 'older_than' argument to remove_expired_responses() --- docs/user_guide/expiration.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/user_guide/expiration.md b/docs/user_guide/expiration.md index 3257571..ab79b24 100644 --- a/docs/user_guide/expiration.md +++ b/docs/user_guide/expiration.md @@ -137,8 +137,15 @@ Or, if you are using {py:func}`.install_cache`: >>> requests_cache.remove_expired_responses() ``` -You can also apply a new `expire_after` value to previously cached responses: +You can also remove responses older than a certain time: ```python +# Remove expired responses *and* responses older than 7 days +remove_expired_responses(older_than=timedelta(days=7)) +``` + +Or apply a new expiration value to previously cached responses: +```python +# Reset expiration for all responses to 30 days from now >>> session.remove_expired_responses(expire_after=timedelta(days=30)) ``` -- cgit v1.2.1