changeset 8342:dd3171263afd

db: introduce long_term_file beaker cache to store README and RSS cache on disk where it is reusable between processes - not in worker memory
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 20 Oct 2019 23:55:46 +0200
parents 6c3a4c4a278e
children a67bcc6f9118
files development.ini kallithea/controllers/feed.py kallithea/controllers/summary.py kallithea/lib/paster_commands/template.ini.mako
diffstat 4 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/development.ini	Fri Feb 07 00:43:34 2020 +0100
+++ b/development.ini	Sun Oct 20 23:55:46 2019 +0200
@@ -275,7 +275,7 @@
 beaker.cache.data_dir = %(here)s/data/cache/data
 beaker.cache.lock_dir = %(here)s/data/cache/lock
 
-beaker.cache.regions = short_term,long_term,sql_cache_short
+beaker.cache.regions = short_term,long_term,sql_cache_short,long_term_file
 
 beaker.cache.short_term.type = memory
 beaker.cache.short_term.expire = 60
@@ -289,6 +289,10 @@
 beaker.cache.sql_cache_short.expire = 10
 beaker.cache.sql_cache_short.key_length = 256
 
+beaker.cache.long_term_file.type = file
+beaker.cache.long_term_file.expire = 604800
+beaker.cache.long_term_file.key_length = 256
+
 ####################################
 ###       BEAKER SESSION        ####
 ####################################
--- a/kallithea/controllers/feed.py	Fri Feb 07 00:43:34 2020 +0100
+++ b/kallithea/controllers/feed.py	Sun Oct 20 23:55:46 2019 +0200
@@ -101,7 +101,7 @@
     def _feed(self, repo_name, feeder):
         """Produce a simple feed"""
 
-        @cache_region('long_term', '_get_feed_from_cache')
+        @cache_region('long_term_file', '_get_feed_from_cache')
         def _get_feed_from_cache(*_cache_keys):  # parameters are not really used - only as caching key
             header = dict(
                 title=_('%s %s feed') % (c.site_name, repo_name),
--- a/kallithea/controllers/summary.py	Fri Feb 07 00:43:34 2020 +0100
+++ b/kallithea/controllers/summary.py	Sun Oct 20 23:55:46 2019 +0200
@@ -66,7 +66,7 @@
         repo_name = db_repo.repo_name
         log.debug('Looking for README file')
 
-        @cache_region('long_term', '_get_readme_from_cache')
+        @cache_region('long_term_file', '_get_readme_from_cache')
         def _get_readme_from_cache(*_cache_keys):  # parameters are not really used - only as caching key
             readme_data = None
             readme_file = None
--- a/kallithea/lib/paster_commands/template.ini.mako	Fri Feb 07 00:43:34 2020 +0100
+++ b/kallithea/lib/paster_commands/template.ini.mako	Sun Oct 20 23:55:46 2019 +0200
@@ -381,7 +381,7 @@
 beaker.cache.data_dir = %(here)s/data/cache/data
 beaker.cache.lock_dir = %(here)s/data/cache/lock
 
-beaker.cache.regions = short_term,long_term,sql_cache_short
+beaker.cache.regions = short_term,long_term,sql_cache_short,long_term_file
 
 beaker.cache.short_term.type = memory
 beaker.cache.short_term.expire = 60
@@ -395,6 +395,10 @@
 beaker.cache.sql_cache_short.expire = 10
 beaker.cache.sql_cache_short.key_length = 256
 
+beaker.cache.long_term_file.type = file
+beaker.cache.long_term_file.expire = 604800
+beaker.cache.long_term_file.key_length = 256
+
 <%text>####################################</%text>
 <%text>###       BEAKER SESSION        ####</%text>
 <%text>####################################</%text>