summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJordan Cook <jordan.cook@pioneer.com>2022-06-10 17:36:20 -0500
committerJordan Cook <jordan.cook@pioneer.com>2022-06-11 11:50:24 -0500
commit275f675bc2fd6d5ffa3363a436867258a8eccd26 (patch)
tree7272c4076ad0c0dd7b375d2052b6f7c0b232d968 /docs
parent319a68b6f5a38344fd70c3db346e78f9a78a0d8c (diff)
downloadrequests-cache-275f675bc2fd6d5ffa3363a436867258a8eccd26.tar.gz
Split up remove_expired_reponses() into remove() and reset_expiration() methods, with more granular arguments
Diffstat (limited to 'docs')
-rw-r--r--docs/user_guide/expiration.md10
-rw-r--r--docs/user_guide/inspection.md6
2 files changed, 8 insertions, 8 deletions
diff --git a/docs/user_guide/expiration.md b/docs/user_guide/expiration.md
index 803c74b..3ce196d 100644
--- a/docs/user_guide/expiration.md
+++ b/docs/user_guide/expiration.md
@@ -150,9 +150,9 @@ For better read performance, expired responses won't be removed immediately, but
(or replaced) the next time they are requested.
To manually clear all expired responses, use
-{py:meth}`.CachedSession.remove_expired_responses`:
+{py:meth}`.BaseCache.remove`:
```python
->>> session.remove_expired_responses()
+>>> session.cache.remove(expired=True)
```
Or, if you are using {py:func}`.install_cache`:
@@ -162,14 +162,14 @@ Or, if you are using {py:func}`.install_cache`:
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))
+# Remove responses older than 7 days
+session.cache.remove(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))
+>>> session.cache.reset_expiration(timedelta(days=30))
```
(ttl)=
diff --git a/docs/user_guide/inspection.md b/docs/user_guide/inspection.md
index 9c21389..26645b2 100644
--- a/docs/user_guide/inspection.md
+++ b/docs/user_guide/inspection.md
@@ -70,10 +70,10 @@ combined keys and responses.
>>> print(list(session.cache.keys()))
```
-Both methods also take a `check_expiry` argument to exclude expired responses:
+Both methods also take a `include_expired` argument. Set to `False` to exclude expired responses:
```python
>>> print('All unexpired responses:')
->>> for response in session.cache.values(check_expiry=True):
+>>> for response in session.cache.values(include_expired=False):
>>> print(response)
```
@@ -81,5 +81,5 @@ Similarly, you can get a count of responses with {py:meth}`.BaseCache.response_c
exclude expired responses:
```python
>>> print(f'Total responses: {session.cache.response_count()}')
->>> print(f'Unexpired responses: {session.cache.response_count(check_expiry=True)}')
+>>> print(f'Unexpired responses: {session.cache.response_count(include_expired=False)}')
```