##// END OF EJS Templates
caches: allow cache disable for file tree
ergo -
r3469:41f317da default
parent child Browse files
Show More
@@ -27,7 +27,7 b' from pyramid.httpexceptions import HTTPF'
27 27
28 28 from rhodecode.lib import helpers as h, diffs
29 29 from rhodecode.lib.utils2 import (
30 StrictAttributeDict, safe_int, datetime_to_time, safe_unicode)
30 StrictAttributeDict, str2bool, safe_int, datetime_to_time, safe_unicode)
31 31 from rhodecode.lib.vcs.exceptions import RepositoryRequirementError
32 32 from rhodecode.model import repo
33 33 from rhodecode.model import repo_group
@@ -278,6 +278,13 b' class RepoAppView(BaseAppView):'
278 278 settings = settings_model.get_general_settings()
279 279 return settings.get(settings_key, default)
280 280
281 def get_recache_flag(self):
282 for flag_name in ['force_recache', 'force-recache', 'no-cache']:
283 flag_val = self.request.GET.get(flag_name)
284 if str2bool(flag_val):
285 return True
286 return False
287
281 288
282 289 class PathFilter(object):
283 290
@@ -229,10 +229,11 b' class RepoFilesView(RepoAppView):'
229 229 self, c, commit_id, f_path, full_load=False):
230 230
231 231 repo_id = self.db_repo.repo_id
232 force_recache = self.get_recache_flag()
232 233
233 234 cache_seconds = safe_int(
234 235 rhodecode.CONFIG.get('rc_cache.cache_repo.expiration_time'))
235 cache_on = cache_seconds > 0
236 cache_on = not force_recache and cache_seconds > 0
236 237 log.debug(
237 238 'Computing FILE TREE for repo_id %s commit_id `%s` and path `%s`'
238 239 'with caching: %s[TTL: %ss]' % (
@@ -137,13 +137,6 b' class RepoPullRequestsView(RepoAppView, '
137 137 })
138 138 return data
139 139
140 def get_recache_flag(self):
141 for flag_name in ['force_recache', 'force-recache', 'no-cache']:
142 flag_val = self.request.GET.get(flag_name)
143 if str2bool(flag_val):
144 return True
145 return False
146
147 140 @LoginRequired()
148 141 @HasRepoPermissionAnyDecorator(
149 142 'repository.read', 'repository.write', 'repository.admin')
General Comments 0
You need to be logged in to leave comments. Login now