Show More
@@ -1697,27 +1697,18 b' class CacheInvalidation(Base, BaseModel)' | |||
|
1697 | 1697 | return inv_obj |
|
1698 | 1698 | |
|
1699 | 1699 | @classmethod |
|
1700 |
def set_invalidate(cls, |
|
|
1700 | def set_invalidate(cls, repo_name): | |
|
1701 | 1701 | """ |
|
1702 | Mark this Cache key for invalidation, either by key or whole | |
|
1703 | cache sets based on repo_name | |
|
1704 | ||
|
1705 | :param key: | |
|
1702 | Mark all caches of a repo as invalid in the database. | |
|
1706 | 1703 | """ |
|
1707 | 1704 | invalidated_keys = [] |
|
1708 | if key: | |
|
1709 | assert not repo_name | |
|
1710 | cache_key = cls._get_cache_key(key) | |
|
1711 | inv_objs = Session().query(cls).filter(cls.cache_key == cache_key).all() | |
|
1712 | else: | |
|
1713 | assert repo_name | |
|
1714 | 1705 |
|
|
1715 | 1706 | |
|
1716 | 1707 | try: |
|
1717 | 1708 | for inv_obj in inv_objs: |
|
1709 | log.debug('marking %s key for invalidation based on repo_name=%s' | |
|
1710 | % (inv_obj, safe_str(repo_name))) | |
|
1718 | 1711 | inv_obj.cache_active = False |
|
1719 | log.debug('marking %s key for invalidation based on key=%s,repo_name=%s' | |
|
1720 | % (inv_obj, key, safe_str(repo_name))) | |
|
1721 | 1712 | invalidated_keys.append(inv_obj.cache_key) |
|
1722 | 1713 | Session().add(inv_obj) |
|
1723 | 1714 | Session().commit() |
@@ -301,7 +301,7 b' class ScmModel(BaseModel):' | |||
|
301 | 301 | |
|
302 | 302 | :param repo_name: the repo for which caches should be marked invalid |
|
303 | 303 | """ |
|
304 |
invalidated_keys = CacheInvalidation.set_invalidate(repo_name |
|
|
304 | invalidated_keys = CacheInvalidation.set_invalidate(repo_name) | |
|
305 | 305 | repo = Repository.get_by_repo_name(repo_name) |
|
306 | 306 | if repo: |
|
307 | 307 | repo.update_changeset_cache() |
General Comments 0
You need to be logged in to leave comments.
Login now