##// 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 Session().add(sett)
257 Session().add(sett)
258
258
259 Session().commit()
259 Session().commit()
260 SettingsModel().invalidate_settings_cache()
260 h.flash(_('Updated application settings'), category='success')
261 h.flash(_('Updated application settings'), category='success')
261
262 except Exception:
262 except Exception:
263 log.exception("Exception while updating application settings")
263 log.exception("Exception while updating application settings")
264 h.flash(
264 h.flash(
@@ -321,7 +321,7 b' class SettingsController(BaseController)'
321 Session().add(sett)
321 Session().add(sett)
322
322
323 Session().commit()
323 Session().commit()
324
324 SettingsModel().invalidate_settings_cache()
325 h.flash(_('Updated visualisation settings'), category='success')
325 h.flash(_('Updated visualisation settings'), category='success')
326 except Exception:
326 except Exception:
327 log.exception("Exception updating visualization settings")
327 log.exception("Exception updating visualization settings")
@@ -403,6 +403,7 b' class SettingsController(BaseController)'
403
403
404 Session().commit()
404 Session().commit()
405
405
406 SettingsModel().invalidate_settings_cache()
406 h.flash(_('Updated issue tracker entries'), category='success')
407 h.flash(_('Updated issue tracker entries'), category='success')
407 return redirect(url('admin_settings_issuetracker'))
408 return redirect(url('admin_settings_issuetracker'))
408
409
@@ -708,6 +709,7 b' class SettingsController(BaseController)'
708 category='error')
709 category='error')
709 else:
710 else:
710 Session().commit()
711 Session().commit()
712 SettingsModel().invalidate_settings_cache()
711 h.flash(_('Updated Labs settings'), category='success')
713 h.flash(_('Updated Labs settings'), category='success')
712 return redirect(url('admin_settings_labs'))
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 def clear_cache_manager(cache_manager):
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 log.debug('Clearing all values for cache manager %s', cache_manager)
96 log.debug('Clearing all values for cache manager %s', cache_manager)
91 cache_manager.clear()
97 cache_manager.clear()
92
98
@@ -201,6 +201,11 b' class SettingsModel(BaseModel):'
201 Session.add(res)
201 Session.add(res)
202 return res
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 def get_all_settings(self, cache=False):
209 def get_all_settings(self, cache=False):
205 def _compute():
210 def _compute():
206 q = self._get_settings_query()
211 q = self._get_settings_query()
@@ -214,6 +219,7 b' class SettingsModel(BaseModel):'
214 return settings
219 return settings
215
220
216 if cache:
221 if cache:
222 log.debug('Fetching app settings using cache')
217 repo = self._get_repo(self.repo) if self.repo else None
223 repo = self._get_repo(self.repo) if self.repo else None
218 namespace = 'rhodecode_settings'
224 namespace = 'rhodecode_settings'
219 cache_manager = caches.get_cache_manager(
225 cache_manager = caches.get_cache_manager(
General Comments 0
You need to be logged in to leave comments. Login now