summaryrefslogtreecommitdiff
path: root/requests_cache/session.py
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 /requests_cache/session.py
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 'requests_cache/session.py')
-rw-r--r--requests_cache/session.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/requests_cache/session.py b/requests_cache/session.py
index 7dca423..b7a8c78 100644
--- a/requests_cache/session.py
+++ b/requests_cache/session.py
@@ -307,17 +307,12 @@ class CacheMixin(MIXIN_BASE):
super().close()
self.cache.close()
- def remove_expired_responses(
- self, expire_after: ExpirationTime = None, older_than: ExpirationTime = None
- ):
- """Remove expired and invalid responses from the cache, and optionally reset expiration
+ def remove_expired_responses(self):
+ """Remove expired and invalid responses from the cache
- Args:
- expire_after: A new expiration value to set on existing cache items (relative to the
- current time)
- older_than: Remove all cache items older than this value
+ **Deprecated:** Use ``session.cache.remove(expired=True)`` instead.
"""
- self.cache.remove_expired_responses(expire_after, older_than)
+ self.cache.remove(expired=True, invalid=True)
def __repr__(self):
return f'<CachedSession(cache={repr(self.cache)}, settings={self.settings})>'