settings: use invalidate after updating settings.
This commit is contained in:
parent
b2175b8e8c
commit
7902155b2e
3 changed files with 16 additions and 2 deletions
|
|
@ -257,8 +257,8 @@ class SettingsController(BaseController):
|
|||
Session().add(sett)
|
||||
|
||||
Session().commit()
|
||||
SettingsModel().invalidate_settings_cache()
|
||||
h.flash(_('Updated application settings'), category='success')
|
||||
|
||||
except Exception:
|
||||
log.exception("Exception while updating application settings")
|
||||
h.flash(
|
||||
|
|
@ -321,7 +321,7 @@ class SettingsController(BaseController):
|
|||
Session().add(sett)
|
||||
|
||||
Session().commit()
|
||||
|
||||
SettingsModel().invalidate_settings_cache()
|
||||
h.flash(_('Updated visualisation settings'), category='success')
|
||||
except Exception:
|
||||
log.exception("Exception updating visualization settings")
|
||||
|
|
@ -403,6 +403,7 @@ class SettingsController(BaseController):
|
|||
|
||||
Session().commit()
|
||||
|
||||
SettingsModel().invalidate_settings_cache()
|
||||
h.flash(_('Updated issue tracker entries'), category='success')
|
||||
return redirect(url('admin_settings_issuetracker'))
|
||||
|
||||
|
|
@ -708,6 +709,7 @@ class SettingsController(BaseController):
|
|||
category='error')
|
||||
else:
|
||||
Session().commit()
|
||||
SettingsModel().invalidate_settings_cache()
|
||||
h.flash(_('Updated Labs settings'), category='success')
|
||||
return redirect(url('admin_settings_labs'))
|
||||
|
||||
|
|
|
|||
|
|
@ -87,6 +87,12 @@ def get_cache_manager(region_name, cache_name, custom_ttl=None):
|
|||
|
||||
|
||||
def clear_cache_manager(cache_manager):
|
||||
"""
|
||||
namespace = 'foobar'
|
||||
cache_manager = get_cache_manager('repo_cache_long', namespace)
|
||||
clear_cache_manager(cache_manager)
|
||||
"""
|
||||
|
||||
log.debug('Clearing all values for cache manager %s', cache_manager)
|
||||
cache_manager.clear()
|
||||
|
||||
|
|
|
|||
|
|
@ -201,6 +201,11 @@ class SettingsModel(BaseModel):
|
|||
Session.add(res)
|
||||
return res
|
||||
|
||||
def invalidate_settings_cache(self):
|
||||
namespace = 'rhodecode_settings'
|
||||
cache_manager = caches.get_cache_manager('sql_cache_short', namespace)
|
||||
caches.clear_cache_manager(cache_manager)
|
||||
|
||||
def get_all_settings(self, cache=False):
|
||||
def _compute():
|
||||
q = self._get_settings_query()
|
||||
|
|
@ -214,6 +219,7 @@ class SettingsModel(BaseModel):
|
|||
return settings
|
||||
|
||||
if cache:
|
||||
log.debug('Fetching app settings using cache')
|
||||
repo = self._get_repo(self.repo) if self.repo else None
|
||||
namespace = 'rhodecode_settings'
|
||||
cache_manager = caches.get_cache_manager(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue