From 572731cc68d5ae0a6eb3a8ad7029fbde4b07274f Mon Sep 17 00:00:00 2001 From: Jordan Cook Date: Tue, 7 Sep 2021 10:45:44 -0500 Subject: [PATCH] Slightly decrease default cache expiration --- docs/user_guide.md | 4 ++-- pyinaturalist/constants.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/user_guide.md b/docs/user_guide.md index 175126ee..b33d407f 100644 --- a/docs/user_guide.md +++ b/docs/user_guide.md @@ -342,8 +342,8 @@ the `session` argument for any API request function. It's recommended to use See Caching and Rate-Limiting sections below for examples. ## Caching -All API requests are cached by default. These expire in 1 hour for most endpoints, and -longer for some infrequently-changing data (like taxa and places). See +All API requests are cached by default. These expire in 30 minutes for most endpoints, and +1 day for some infrequently-changing data (like taxa and places). See [requests-cache: Expiration](https://requests-cache.readthedocs.io/en/latest/user_guide/expiration.html) for details on cache expiration behavior. diff --git a/pyinaturalist/constants.py b/pyinaturalist/constants.py index 11743bc8..da204c17 100644 --- a/pyinaturalist/constants.py +++ b/pyinaturalist/constants.py @@ -51,10 +51,10 @@ # Cache settings CACHE_EXPIRATION = { - 'api.inaturalist.org/v*/controlled_terms*': timedelta(days=30), - 'api.inaturalist.org/v*/places*': timedelta(days=7), - 'api.inaturalist.org/v*/taxa*': timedelta(days=30), - '*': timedelta(hours=1), + 'api.inaturalist.org/v*/controlled_terms*': timedelta(days=1), + 'api.inaturalist.org/v*/places*': timedelta(days=1), + 'api.inaturalist.org/v*/taxa*': timedelta(days=1), + '*': timedelta(minutes=30), } CACHE_FILE = join(CACHE_DIR, 'api_requests.db') TOKEN_EXPIRATION = timedelta(hours=1)