summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJordan Cook <jordan.cook.git@proton.me>2022-09-29 15:28:04 -0500
committerJordan Cook <jordan.cook.git@proton.me>2022-09-30 16:00:16 -0500
commit747f472e7a50274f45e414c9ee4f8fe70f6f1131 (patch)
tree9161e6288f3dcdb09ef636e99db470b9f9fcd203 /docs
parente06d915d12f97a72b932be7dc67ccf4b80077324 (diff)
downloadrequests-cache-747f472e7a50274f45e414c9ee4f8fe70f6f1131.tar.gz
Add ttl_offset argument for Redis backend
Diffstat (limited to 'docs')
-rw-r--r--docs/user_guide/backends/redis.md12
1 files changed, 8 insertions, 4 deletions
diff --git a/docs/user_guide/backends/redis.md b/docs/user_guide/backends/redis.md
index 141834c..56df69a 100644
--- a/docs/user_guide/backends/redis.md
+++ b/docs/user_guide/backends/redis.md
@@ -46,12 +46,16 @@ or disabled entirely. See [Redis Persistence](https://redis.io/topics/persistenc
## Expiration
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 <expiration>`.
-
-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.
+See [Redis: EXPIRE](https://redis.io/commands/expire/) docs for more details on internal TTL behavior.
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:
+you can use the `ttl_offset` argument to add additional time before deletion (default: 1 hour).
+In other words, this makes backend expiration longer than cache expiration:
+```python
+>>> backend = RedisCache(ttl_offset=3600)
+```
+
+Alternatively, you can disable TTL completely with the `ttl` argument:
```python
>>> backend = RedisCache(ttl=False)
```