##// END OF EJS Templates
settings: use invalidate after updating settings.
marcink -
r276:7f18164f default
parent child Browse files
Show More
@@ -257,8 +257,8 b' class SettingsController(BaseController)'
257 257 Session().add(sett)
258 258
259 259 Session().commit()
260 SettingsModel().invalidate_settings_cache()
260 261 h.flash(_('Updated application settings'), category='success')
261
262 262 except Exception:
263 263 log.exception("Exception while updating application settings")
264 264 h.flash(
@@ -321,7 +321,7 b' class SettingsController(BaseController)'
321 321 Session().add(sett)
322 322
323 323 Session().commit()
324
324 SettingsModel().invalidate_settings_cache()
325 325 h.flash(_('Updated visualisation settings'), category='success')
326 326 except Exception:
327 327 log.exception("Exception updating visualization settings")
@@ -403,6 +403,7 b' class SettingsController(BaseController)'
403 403
404 404 Session().commit()
405 405
406 SettingsModel().invalidate_settings_cache()
406 407 h.flash(_('Updated issue tracker entries'), category='success')
407 408 return redirect(url('admin_settings_issuetracker'))
408 409
@@ -708,6 +709,7 b' class SettingsController(BaseController)'
708 709 category='error')
709 710 else:
710 711 Session().commit()
712 SettingsModel().invalidate_settings_cache()
711 713 h.flash(_('Updated Labs settings'), category='success')
712 714 return redirect(url('admin_settings_labs'))
713 715
@@ -87,6 +87,12 b' def get_cache_manager(region_name, cache'
87 87
88 88
89 89 def clear_cache_manager(cache_manager):
90 """
91 namespace = 'foobar'
92 cache_manager = get_cache_manager('repo_cache_long', namespace)
93 clear_cache_manager(cache_manager)
94 """
95
90 96 log.debug('Clearing all values for cache manager %s', cache_manager)
91 97 cache_manager.clear()
92 98
@@ -201,6 +201,11 b' class SettingsModel(BaseModel):'
201 201 Session.add(res)
202 202 return res
203 203
204 def invalidate_settings_cache(self):
205 namespace = 'rhodecode_settings'
206 cache_manager = caches.get_cache_manager('sql_cache_short', namespace)
207 caches.clear_cache_manager(cache_manager)
208
204 209 def get_all_settings(self, cache=False):
205 210 def _compute():
206 211 q = self._get_settings_query()
@@ -214,6 +219,7 b' class SettingsModel(BaseModel):'
214 219 return settings
215 220
216 221 if cache:
222 log.debug('Fetching app settings using cache')
217 223 repo = self._get_repo(self.repo) if self.repo else None
218 224 namespace = 'rhodecode_settings'
219 225 cache_manager = caches.get_cache_manager(
General Comments 0
You need to be logged in to leave comments. Login now