summaryrefslogtreecommitdiff
path: root/requests_cache/backends
diff options
context:
space:
mode:
authorJordan Cook <jordan.cook@pioneer.com>2022-03-10 13:03:44 -0600
committerJordan Cook <jordan.cook@pioneer.com>2022-03-11 09:02:56 -0600
commit39e0acee98b9995bd51d0f051a0060c2e5b6abe8 (patch)
tree5b9c2eb5328c2e45e18d965d5d69752bd47626ab /requests_cache/backends
parentae4788e75ff84606d5d907256cd7175af5af9b5d (diff)
downloadrequests-cache-39e0acee98b9995bd51d0f051a0060c2e5b6abe8.tar.gz
Reword inaccurate usage of the term 'revalidate'
Diffstat (limited to 'requests_cache/backends')
-rw-r--r--requests_cache/backends/base.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/requests_cache/backends/base.py b/requests_cache/backends/base.py
index 6714bcb..2126381 100644
--- a/requests_cache/backends/base.py
+++ b/requests_cache/backends/base.py
@@ -161,21 +161,21 @@ class BaseCache:
yield key
def remove_expired_responses(self, expire_after: ExpirationTime = None):
- """Remove expired and invalid responses from the cache, optionally with revalidation
+ """Remove expired and invalid responses from the cache, and optionally reset expiration
Args:
- expire_after: A new expiration time used to revalidate the cache
+ expire_after: A new expiration time to set on existing cache items
"""
logger.info(
'Removing expired responses.'
- + (f'Revalidating with: {expire_after}' if expire_after else '')
+ + (f'Resetting expiration with: {expire_after}' if expire_after else '')
)
keys_to_update = {}
keys_to_delete = []
for key, response in self._get_valid_responses(delete=True):
- # If we're revalidating and it's not yet expired, update the cached item's expiration
- if expire_after is not None and not response.revalidate(expire_after):
+ # If we're resetting expiration and it's not yet expired, update the cached item's expiration
+ if expire_after is not None and not response.reset_expiration(expire_after):
keys_to_update[key] = response
if response.is_expired:
keys_to_delete.append(key)
@@ -184,7 +184,7 @@ class BaseCache:
logger.debug(f'Deleting {len(keys_to_delete)} expired responses')
self.bulk_delete(keys_to_delete)
if expire_after is not None:
- logger.debug(f'Updating {len(keys_to_update)} revalidated responses')
+ logger.debug(f'Updating {len(keys_to_update)} response expirations')
for key, response in keys_to_update.items():
self.responses[key] = response