Show More
@@ -37,7 +37,7 b' from rhodecode.lib.utils import ask_ok' | |||
|
37 | 37 | from rhodecode.model import init_model |
|
38 | 38 | from rhodecode.model.db import User, Permission, RhodeCodeUi, \ |
|
39 | 39 | RhodeCodeSetting, UserToPerm, DbMigrateVersion, RepoGroup, \ |
|
40 | UserRepoGroupToPerm | |
|
40 | UserRepoGroupToPerm, CacheInvalidation | |
|
41 | 41 | |
|
42 | 42 | from sqlalchemy.engine import create_engine |
|
43 | 43 | from rhodecode.model.repos_group import ReposGroupModel |
@@ -150,6 +150,10 b' class DbManage(object):' | |||
|
150 | 150 | if curr_version == __dbversion__: |
|
151 | 151 | sys.exit('This database is already at the newest version') |
|
152 | 152 | |
|
153 | # clear cache keys | |
|
154 | log.info("Clearing cache keys now...") | |
|
155 | CacheInvalidation.clear_cache() | |
|
156 | ||
|
153 | 157 | #====================================================================== |
|
154 | 158 | # UPGRADE STEPS |
|
155 | 159 | #====================================================================== |
@@ -1806,6 +1806,15 b' class CacheInvalidation(Base, BaseModel)' | |||
|
1806 | 1806 | return self._cache_key_partition()[2] |
|
1807 | 1807 | |
|
1808 | 1808 | @classmethod |
|
1809 | def clear_cache(cls): | |
|
1810 | """ | |
|
1811 | Delete all cache keys from database. | |
|
1812 | Should only be run when all instances are down and all entries thus stale. | |
|
1813 | """ | |
|
1814 | cls.query().delete() | |
|
1815 | Session().commit() | |
|
1816 | ||
|
1817 | @classmethod | |
|
1809 | 1818 | def _get_cache_key(cls, key): |
|
1810 | 1819 | """ |
|
1811 | 1820 | Wrapper for generating a unique cache key for this instance and "key". |
General Comments 0
You need to be logged in to leave comments.
Login now