summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJordan Cook <JWCook@users.noreply.github.com>2022-04-15 19:26:01 -0500
committerGitHub <noreply@github.com>2022-04-15 19:26:01 -0500
commit166f5690fb8d5b067f839fa8ffb9421cf1b8a7e7 (patch)
tree500a5b605327efbc1043d6a982ae4337c0d06930 /docs
parentd6a1fecb07ec69d9c15301f3876493ebd799d4ad (diff)
parentbcaaea5ebe3063a2c020449a028d49b6e2eebbea (diff)
downloadrequests-cache-166f5690fb8d5b067f839fa8ffb9421cf1b8a7e7.tar.gz
Merge pull request #584 from JWCook/mongodb
Improvements for MongoDB backend
Diffstat (limited to 'docs')
-rw-r--r--docs/_static/mongodb_vscode.pngbin0 -> 216933 bytes
-rw-r--r--docs/user_guide/expiration.md18
2 files changed, 13 insertions, 5 deletions
diff --git a/docs/_static/mongodb_vscode.png b/docs/_static/mongodb_vscode.png
new file mode 100644
index 0000000..cccc18d
--- /dev/null
+++ b/docs/_static/mongodb_vscode.png
Binary files differ
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`,