diff --git a/development.ini b/development.ini --- a/development.ini +++ b/development.ini @@ -275,11 +275,7 @@ celery.task_always_eager = false 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,long_term_file - -beaker.cache.short_term.type = memory -beaker.cache.short_term.expire = 60 -beaker.cache.short_term.key_length = 256 +beaker.cache.regions = long_term,long_term_file beaker.cache.long_term.type = memory beaker.cache.long_term.expire = 36000 diff --git a/kallithea/lib/paster_commands/template.ini.mako b/kallithea/lib/paster_commands/template.ini.mako --- a/kallithea/lib/paster_commands/template.ini.mako +++ b/kallithea/lib/paster_commands/template.ini.mako @@ -381,11 +381,7 @@ celery.task_always_eager = false 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,long_term_file - -beaker.cache.short_term.type = memory -beaker.cache.short_term.expire = 60 -beaker.cache.short_term.key_length = 256 +beaker.cache.regions = long_term,long_term_file beaker.cache.long_term.type = memory beaker.cache.long_term.expire = 36000 diff --git a/kallithea/lib/utils.py b/kallithea/lib/utils.py --- a/kallithea/lib/utils.py +++ b/kallithea/lib/utils.py @@ -602,32 +602,3 @@ def check_git_version(): settings.GIT_EXECUTABLE_PATH, output) return ver - - -#=============================================================================== -# CACHE RELATED METHODS -#=============================================================================== - -def conditional_cache(region, prefix, condition, func): - """ - Conditional caching function use like:: - def func(arg): - #heavy computation function - return data - - # depending from condition the compute is wrapped in cache or not - compute = conditional_cache('short_term', 'cache_desc', condition=True, func=func) - return compute(arg) - - :param region: name of cache region - :param prefix: cache region prefix - :param condition: condition for cache to be triggered, and return data cached - :param func: heavy function to compute - """ - wrapped = func - if condition: - log.debug('conditional_cache: True, wrapping call of ' - 'func: %s into %s region cache' % (region, func)) - wrapped = beaker.cache._cache_decorate((prefix,), None, None, region)(func) - - return wrapped