diff options
author | Jordan Cook <jordan.cook@pioneer.com> | 2022-04-12 19:22:22 -0500 |
---|---|---|
committer | Jordan Cook <jordan.cook@pioneer.com> | 2022-04-15 18:32:19 -0500 |
commit | 08248be2b1502a2adda0ecfdd1d86bd981dc256e (patch) | |
tree | 9b057bad333cdbbd22593b6b1ab02cea86bbd877 /docs | |
parent | 341303f78d95f44ed52208e7d90e05b49afea1cb (diff) | |
download | requests-cache-08248be2b1502a2adda0ecfdd1d86bd981dc256e.tar.gz |
Update general expiration docs
Diffstat (limited to 'docs')
-rw-r--r-- | docs/user_guide/expiration.md | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/docs/user_guide/expiration.md b/docs/user_guide/expiration.md index f6a90aa..767b220 100644 --- a/docs/user_guide/expiration.md +++ b/docs/user_guide/expiration.md @@ -114,12 +114,10 @@ In addition to HTTP error codes, `stale_if_error` also applies to python excepti for more details on request errors in general. ## Removing Expired Responses + +### Manual Removal For better read performance, expired responses won't be removed immediately, but will be removed (or replaced) the next time they are requested. -:::{tip} -Implementing one or more cache eviction algorithms is being considered. If this is something you are -interested in, please provide feedback via [issues](https://github.com/reclosedev/requests-cache/issues)! -::: To manually clear all expired responses, use {py:meth}`.CachedSession.remove_expired_responses`: @@ -127,7 +125,7 @@ To manually clear all expired responses, use >>> session.remove_expired_responses() ``` -Or, when using patching: +Or, if you are using {py:func}`.install_cache`: ```python >>> requests_cache.remove_expired_responses() ``` @@ -137,6 +135,16 @@ You can also apply a new `expire_after` value to previously cached responses: >>> session.remove_expired_responses(expire_after=timedelta(days=30)) ``` +### Automatic Removal +The following backends have native TTL support, which can be used to automatically remove expired +responses: +* {py:mod}`MongoDB <requests_cache.backends.mongodb>` +* {py:mod}`Redis <requests_cache.backends.redis>` +<!-- +TODO: Not yet supported: +* {py:mod}`DynamoDB <requests_cache.backends.dynamodb>` +--> + ## Request Options In addition to the base arguments for {py:func}`requests.request`, requests-cache adds some extra cache-related arguments. These apply to {py:meth}`.CachedSession.request`, |