From 8abd951d400c7a3a2d4b549ce7854259e90a0ed6 Mon Sep 17 00:00:00 2001 From: pictuga Date: Sat, 3 Oct 2020 19:55:57 +0200 Subject: [PATCH] More sensible default values for cache autotrim (1k entries, 1min) --- README.md | 4 ++-- morss/crawler.py | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4241870..ebf1909 100644 --- a/README.md +++ b/README.md @@ -376,10 +376,10 @@ environment variables: `MYSQL_USER`, `MYSQL_PWD`, `MYSQL_DB`, `MYSQL_HOST` To limit the size of the cache: - `CACHE_SIZE` sets the target number of items in the cache (further items will -be deleted but the cache might be temporarily bigger than that). Defaults to 10k +be deleted but the cache might be temporarily bigger than that). Defaults to 1k entries. - `CACHE_LIFESPAN` sets how often the cache must be trimmed (i.e. cut down to -the number of items set in `CACHE_SIZE`). Defaults to 1hr. +the number of items set in `CACHE_SIZE`). Defaults to 1min. ### Content matching diff --git a/morss/crawler.py b/morss/crawler.py index 54a7ce7..f074031 100644 --- a/morss/crawler.py +++ b/morss/crawler.py @@ -50,9 +50,8 @@ except NameError: basestring = unicode = str -CACHE_SIZE = int(os.getenv('CACHE_SIZE', 10000)) # max number of items in cache (default: 10k items) -CACHE_LIFESPAN = int(os.getenv('CACHE_LIFESPAN', 60*60)) # how often to auto-clear the cache (default: 1hr) - +CACHE_SIZE = int(os.getenv('CACHE_SIZE', 1000)) # max number of items in cache (default: 1k items) +CACHE_LIFESPAN = int(os.getenv('CACHE_LIFESPAN', 60)) # how often to auto-clear the cache (default: 1min) # uncomment the lines below to ignore SSL certs #import ssl