Show More
@@ -204,8 +204,8 b' class RepoFilesView(RepoAppView):' | |||
|
204 | 204 | cache_namespace_uid = 'cache_repo.{}'.format(repo_id) |
|
205 | 205 | region = rc_cache.get_or_create_region('cache_repo', cache_namespace_uid) |
|
206 | 206 | |
|
207 | @region.cache_on_arguments(namespace=cache_namespace_uid, | |
|
208 |
|
|
|
207 | @region.conditional_cache_on_arguments(namespace=cache_namespace_uid, | |
|
208 | condition=cache_on) | |
|
209 | 209 | def compute_file_tree(repo_id, commit_id, f_path, full_load): |
|
210 | 210 | log.debug('Generating cached file tree for repo_id: %s, %s, %s', |
|
211 | 211 | repo_id, commit_id, f_path) |
@@ -796,8 +796,8 b' class RepoFilesView(RepoAppView):' | |||
|
796 | 796 | cache_namespace_uid = 'cache_repo.{}'.format(repo_id) |
|
797 | 797 | region = rc_cache.get_or_create_region('cache_repo', cache_namespace_uid) |
|
798 | 798 | |
|
799 | @region.cache_on_arguments(namespace=cache_namespace_uid, | |
|
800 |
|
|
|
799 | @region.conditional_cache_on_arguments(namespace=cache_namespace_uid, | |
|
800 | condition=cache_on) | |
|
801 | 801 | def compute_file_search(repo_id, commit_id, f_path): |
|
802 | 802 | log.debug('Generating cached nodelist for repo_id:%s, %s, %s', |
|
803 | 803 | repo_id, commit_id, f_path) |
@@ -261,8 +261,8 b' class RepoSummaryView(RepoAppView):' | |||
|
261 | 261 | cache_namespace_uid = 'cache_repo.{}'.format(repo_id) |
|
262 | 262 | region = rc_cache.get_or_create_region('cache_repo', cache_namespace_uid) |
|
263 | 263 | |
|
264 | @region.cache_on_arguments(namespace=cache_namespace_uid, | |
|
265 |
|
|
|
264 | @region.conditional_cache_on_arguments(namespace=cache_namespace_uid, | |
|
265 | condition=cache_on) | |
|
266 | 266 | def compute_stats(repo_id, commit_id, show_stats): |
|
267 | 267 | code_stats = {} |
|
268 | 268 | size = 0 |
@@ -700,9 +700,9 b' def authenticate(username, password, env' | |||
|
700 | 700 | cache_namespace_uid = 'cache_user_auth.{}'.format(user_id) |
|
701 | 701 | region = rc_cache.get_or_create_region('cache_perms', cache_namespace_uid) |
|
702 | 702 | |
|
703 | @region.cache_on_arguments(namespace=cache_namespace_uid, | |
|
703 | @region.conditional_cache_on_arguments(namespace=cache_namespace_uid, | |
|
704 | 704 | expiration_time=cache_ttl, |
|
705 |
|
|
|
705 | condition=plugin_cache_active) | |
|
706 | 706 | def compute_auth( |
|
707 | 707 | cache_name, plugin_name, username, password): |
|
708 | 708 |
@@ -1079,8 +1079,8 b' class AuthUser(object):' | |||
|
1079 | 1079 | cache_namespace_uid = 'cache_user_auth.{}'.format(user_id) |
|
1080 | 1080 | region = rc_cache.get_or_create_region('cache_perms', cache_namespace_uid) |
|
1081 | 1081 | |
|
1082 | @region.cache_on_arguments(namespace=cache_namespace_uid, | |
|
1083 |
|
|
|
1082 | @region.conditional_cache_on_arguments(namespace=cache_namespace_uid, | |
|
1083 | condition=cache_on) | |
|
1084 | 1084 | def compute_perm_tree(cache_name, |
|
1085 | 1085 | user_id, scope, user_is_admin,user_inherit_default_permissions, |
|
1086 | 1086 | explicit, algo, calculate_super_admin): |
@@ -1277,8 +1277,8 b' class AuthUser(object):' | |||
|
1277 | 1277 | _set = set() |
|
1278 | 1278 | |
|
1279 | 1279 | if inherit_from_default: |
|
1280 | default_ips = UserIpMap.query().filter( | |
|
1281 | UserIpMap.user == User.get_default_user(cache=True)) | |
|
1280 | def_user_id = User.get_default_user(cache=True).user_id | |
|
1281 | default_ips = UserIpMap.query().filter(UserIpMap.user_id == def_user_id) | |
|
1282 | 1282 | if cache: |
|
1283 | 1283 | default_ips = default_ips.options( |
|
1284 | 1284 | FromCache("sql_cache_short", "get_user_ips_default")) |
@@ -317,9 +317,9 b' class SimpleVCS(object):' | |||
|
317 | 317 | cache_namespace_uid = 'cache_user_auth.{}'.format(user_id) |
|
318 | 318 | region = rc_cache.get_or_create_region('cache_perms', cache_namespace_uid) |
|
319 | 319 | |
|
320 | @region.cache_on_arguments(namespace=cache_namespace_uid, | |
|
320 | @region.conditional_cache_on_arguments(namespace=cache_namespace_uid, | |
|
321 | 321 | expiration_time=cache_ttl, |
|
322 |
|
|
|
322 | condition=plugin_cache_active) | |
|
323 | 323 | def compute_perm_vcs( |
|
324 | 324 | cache_name, plugin_id, action, user_id, repo_name, ip_addr): |
|
325 | 325 |
@@ -216,7 +216,7 b' class SettingsModel(BaseModel):' | |||
|
216 | 216 | def get_all_settings(self, cache=False): |
|
217 | 217 | region = rc_cache.get_or_create_region('sql_cache_short') |
|
218 | 218 | |
|
219 |
@region.cache_on_arguments( |
|
|
219 | @region.conditional_cache_on_arguments(condition=cache) | |
|
220 | 220 | def _get_all_settings(name, key): |
|
221 | 221 | q = self._get_settings_query() |
|
222 | 222 | if not q: |
@@ -78,7 +78,7 b' class TestCaches(object):' | |||
|
78 | 78 | |
|
79 | 79 | assert cache_region.backend.list_keys() == [] |
|
80 | 80 | |
|
81 | @cache_region.cache_on_arguments(expiration_time=5) | |
|
81 | @cache_region.conditional_cache_on_arguments(expiration_time=5) | |
|
82 | 82 | def compute(key): |
|
83 | 83 | return time.time() |
|
84 | 84 | |
@@ -94,7 +94,7 b' class TestCaches(object):' | |||
|
94 | 94 | cache_region.delete(key) |
|
95 | 95 | assert cache_region.backend.list_keys() == [] |
|
96 | 96 | |
|
97 | @cache_region.cache_on_arguments(expiration_time=5) | |
|
97 | @cache_region.conditional_cache_on_arguments(expiration_time=5) | |
|
98 | 98 | def compute(key): |
|
99 | 99 | return time.time() |
|
100 | 100 |
General Comments 0
You need to be logged in to leave comments.
Login now