feat: Separate cache expiry for stats and search

Allows us to set different cache eviction timespans  for search queries
and statistics.

Stats and especially "last package updates" should probably be refreshed
more often, whereas we might want to cache search results for a bit
longer.

So this gives us a bit more flexibility playing around with different
settings and tweak things.

Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
moson 2023-07-22 21:23:16 +02:00
parent 44c158b8c2
commit 8699457917
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
4 changed files with 7 additions and 5 deletions

View file

@ -89,7 +89,7 @@ class Statistics:
def update_prometheus_metrics():
cache_expire = config.getint("cache", "expiry_time")
cache_expire = config.getint("cache", "expiry_time_statistics", 300)
stats = Statistics(cache_expire)
# Users gauge
for counter, utype in stats.PROMETHEUS_USER_COUNTERS: