From 4027534c17a26e5e7569dea4de00f226a1aecfa4 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Sat, 2 May 2020 10:25:48 -0400 Subject: [PATCH] reduce cache maxsize (#20) --- app/services/location/jhu.py | 4 ++-- app/services/location/nyt.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/location/jhu.py b/app/services/location/jhu.py index 11f6d120..1a11e8ac 100644 --- a/app/services/location/jhu.py +++ b/app/services/location/jhu.py @@ -46,10 +46,10 @@ async def get(self, loc_id): # pylint: disable=arguments-differ ) -@cached(cache=TTLCache(maxsize=1024, ttl=1800)) +@cached(cache=TTLCache(maxsize=128, ttl=1800)) async def get_category(category): """ - Retrieves the data for the provided category. The data is cached for 1 hour. + Retrieves the data for the provided category. The data is cached for 30 minutes locally, 1 hour via shared Redis. :returns: The data for category. :rtype: dict diff --git a/app/services/location/nyt.py b/app/services/location/nyt.py index b33f5d3c..8b70c5cc 100644 --- a/app/services/location/nyt.py +++ b/app/services/location/nyt.py @@ -66,7 +66,7 @@ def get_grouped_locations_dict(data): return grouped_locations -@cached(cache=TTLCache(maxsize=1024, ttl=3600)) +@cached(cache=TTLCache(maxsize=128, ttl=3600)) async def get_locations(): """ Returns a list containing parsed NYT data by US county. The data is cached for 1 hour.