diff options
author | James Moger <james.moger@gitblit.com> | 2013-07-16 09:35:31 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-07-16 09:35:31 -0400 |
commit | f01bc58183dca2378ffe931315396583d053c6be (patch) | |
tree | f7be4abdf4d3116890e144ff350195b12e92a173 /src/main/java/com/gitblit/utils/CommitCache.java | |
parent | f10286ce6371624fb49486202f14d3f75f866cc4 (diff) | |
download | gitblit-f01bc58183dca2378ffe931315396583d053c6be.tar.gz gitblit-f01bc58183dca2378ffe931315396583d053c6be.zip |
Reset dashboard and activity commit cache on branch REWIND or DELETE
Diffstat (limited to 'src/main/java/com/gitblit/utils/CommitCache.java')
-rw-r--r-- | src/main/java/com/gitblit/utils/CommitCache.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/utils/CommitCache.java b/src/main/java/com/gitblit/utils/CommitCache.java index 9db5f0c9..e84506ea 100644 --- a/src/main/java/com/gitblit/utils/CommitCache.java +++ b/src/main/java/com/gitblit/utils/CommitCache.java @@ -110,6 +110,23 @@ public class CommitCache { } /** + * Clears the commit cache for a specific branch of a specific repository. + * + * @param repositoryName + * @param branch + */ + public void clear(String repositoryName, String branch) { + String repoKey = repositoryName.toLowerCase(); + ObjectCache<List<RepositoryCommit>> repoCache = cache.get(repoKey); + if (repoCache != null) { + List<RepositoryCommit> commits = repoCache.remove(branch.toLowerCase()); + if (!ArrayUtils.isEmpty(commits)) { + logger.info(MessageFormat.format("{0}:{1} commit cache cleared", repositoryName, branch)); + } + } + } + + /** * Get all commits for the specified repository:branch that are in the cache. * * @param repositoryName |