From 12b7ebe4ea4a938884b10d8b676c7504b7996017 Mon Sep 17 00:00:00 2001 From: Jordan Cook Date: Fri, 22 Apr 2022 17:31:44 -0500 Subject: Update docs and changelog --- docs/user_guide/backends/filesystem.md | 14 +++----------- docs/user_guide/backends/redis.md | 3 +++ docs/user_guide/expiration.md | 6 ++---- 3 files changed, 8 insertions(+), 15 deletions(-) (limited to 'docs') diff --git a/docs/user_guide/backends/filesystem.md b/docs/user_guide/backends/filesystem.md index 9fdee7c..07e41c4 100644 --- a/docs/user_guide/backends/filesystem.md +++ b/docs/user_guide/backends/filesystem.md @@ -26,17 +26,9 @@ Or by alias: ``` ## File Formats -By default, responses are saved as pickle files. If you want to save responses in a human-readable -format, you can use one of the other available {ref}`serializers`. For example, to save responses as -JSON files: -```python ->>> session = CachedSession('~/http_cache', backend='filesystem', serializer='json') ->>> session.get('https://httpbin.org/get') ->>> print(list(session.cache.paths())) -> ['/home/user/http_cache/4dc151d95200ec.json'] -``` - -Or as YAML (requires `pyyaml`): +By default, responses are saved as JSON files. If you prefer a deiffernt format, you can use of the +other available {ref}`serializers` or provide your own. For example, to save responses as +YAML files (requires `pyyaml`): ```python >>> session = CachedSession('~/http_cache', backend='filesystem', serializer='yaml') >>> session.get('https://httpbin.org/get') diff --git a/docs/user_guide/backends/redis.md b/docs/user_guide/backends/redis.md index cfe1898..141834c 100644 --- a/docs/user_guide/backends/redis.md +++ b/docs/user_guide/backends/redis.md @@ -47,6 +47,9 @@ or disabled entirely. See [Redis Persistence](https://redis.io/topics/persistenc Redis natively supports TTL on a per-key basis, and can automatically remove expired responses from the cache. This will be set by by default, according to normal {ref}`expiration settings `. +Expired items are not removed immediately, but will never be returned from the cache. See +[Redis: EXPIRE](https://redis.io/commands/expire/) docs for more details. + If you intend to reuse expired responses, e.g. with {ref}`conditional-requests` or `stale_if_error`, you can disable this behavior with the `ttl` argument: ```python diff --git a/docs/user_guide/expiration.md b/docs/user_guide/expiration.md index d0465f1..a53da87 100644 --- a/docs/user_guide/expiration.md +++ b/docs/user_guide/expiration.md @@ -142,15 +142,13 @@ You can also apply a new `expire_after` value to previously cached responses: >>> session.remove_expired_responses(expire_after=timedelta(days=30)) ``` +(ttl)= ### Automatic Removal The following backends have native TTL support, which can be used to automatically remove expired responses: +* {py:mod}`DynamoDB ` * {py:mod}`MongoDB ` * {py:mod}`Redis ` - ## Request Options In addition to the base arguments for {py:func}`requests.request`, requests-cache adds some extra -- cgit v1.2.1