Clean up Repository cache code.
This commit is contained in:
parent
153085a93b
commit
b1f4d14f7d
|
@ -105,29 +105,25 @@ class Repository
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_branch(branch_name, ref)
|
def add_branch(branch_name, ref)
|
||||||
cache.expire(:branch_names)
|
expire_branches_cache
|
||||||
@branches = nil
|
|
||||||
|
|
||||||
gitlab_shell.add_branch(path_with_namespace, branch_name, ref)
|
gitlab_shell.add_branch(path_with_namespace, branch_name, ref)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_tag(tag_name, ref, message = nil)
|
def add_tag(tag_name, ref, message = nil)
|
||||||
cache.expire(:tag_names)
|
expire_tags_cache
|
||||||
@tags = nil
|
|
||||||
|
|
||||||
gitlab_shell.add_tag(path_with_namespace, tag_name, ref, message)
|
gitlab_shell.add_tag(path_with_namespace, tag_name, ref, message)
|
||||||
end
|
end
|
||||||
|
|
||||||
def rm_branch(branch_name)
|
def rm_branch(branch_name)
|
||||||
cache.expire(:branch_names)
|
expire_branches_cache
|
||||||
@branches = nil
|
|
||||||
|
|
||||||
gitlab_shell.rm_branch(path_with_namespace, branch_name)
|
gitlab_shell.rm_branch(path_with_namespace, branch_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def rm_tag(tag_name)
|
def rm_tag(tag_name)
|
||||||
cache.expire(:tag_names)
|
expire_tags_cache
|
||||||
@tags = nil
|
|
||||||
|
|
||||||
gitlab_shell.rm_tag(path_with_namespace, tag_name)
|
gitlab_shell.rm_tag(path_with_namespace, tag_name)
|
||||||
end
|
end
|
||||||
|
@ -169,6 +165,16 @@ class Repository
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def expire_tags_cache
|
||||||
|
cache.expire(:tag_names)
|
||||||
|
@tags = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def expire_branches_cache
|
||||||
|
cache.expire(:branch_names)
|
||||||
|
@branches = nil
|
||||||
|
end
|
||||||
|
|
||||||
def expire_cache
|
def expire_cache
|
||||||
cache_keys.each do |key|
|
cache_keys.each do |key|
|
||||||
cache.expire(key)
|
cache.expire(key)
|
||||||
|
|
Loading…
Reference in New Issue