summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-11-29 12:02:58 -0500
committerJames Moger <james.moger@gitblit.com>2013-11-29 12:02:58 -0500
commit3811378e0ec542e1ec3139406bbf0fc395e9d3df (patch)
tree15ea3d2c134523573769dc8ca9390990a674996e
parentdb983266cea3b57193343cfbec2a6cbcce08b835 (diff)
downloadgitblit-3811378e0ec542e1ec3139406bbf0fc395e9d3df.tar.gz
gitblit-3811378e0ec542e1ec3139406bbf0fc395e9d3df.zip
Invalidate all cached repository data on "clear cache" (issue-346)
Change-Id: I14404e38bbc6f5827c430849baf3c13f4df2c6ef
-rw-r--r--releases.moxie1
-rw-r--r--src/main/java/com/gitblit/manager/RepositoryManager.java2
-rw-r--r--src/main/java/com/gitblit/utils/ObjectCache.java4
3 files changed, 7 insertions, 0 deletions
diff --git a/releases.moxie b/releases.moxie
index c2ad4fce..3a1b296c 100644
--- a/releases.moxie
+++ b/releases.moxie
@@ -13,6 +13,7 @@ r20: {
- Fixed support for implied SSH urls in web.otherUrls (issue-311)
- Bind LDAP connection after establishing TLS initialization (issue-343)
- Fixed NPE when attempting to add a permission without a registrant (issue-344)
+ - Invalidate all cached repository data on "clear cache" (issue-346)
- Fix potential NPE on removing uncached repository from cache
- Ignore the default contents of .git/description file
- Fix error on generating activity page when there is no activity
diff --git a/src/main/java/com/gitblit/manager/RepositoryManager.java b/src/main/java/com/gitblit/manager/RepositoryManager.java
index 438d885c..0a3f6631 100644
--- a/src/main/java/com/gitblit/manager/RepositoryManager.java
+++ b/src/main/java/com/gitblit/manager/RepositoryManager.java
@@ -457,6 +457,8 @@ public class RepositoryManager implements IRepositoryManager {
public void resetRepositoryListCache() {
logger.info("Repository cache manually reset");
repositoryListCache.clear();
+ repositorySizeCache.clear();
+ repositoryMetricsCache.clear();
}
/**
diff --git a/src/main/java/com/gitblit/utils/ObjectCache.java b/src/main/java/com/gitblit/utils/ObjectCache.java
index 48a9668d..e75d4b86 100644
--- a/src/main/java/com/gitblit/utils/ObjectCache.java
+++ b/src/main/java/com/gitblit/utils/ObjectCache.java
@@ -54,6 +54,10 @@ public class ObjectCache<X> implements Serializable {
}
}
+ public void clear() {
+ cache.clear();
+ }
+
public boolean hasCurrent(String name, Date date) {
return cache.containsKey(name) && cache.get(name).date.compareTo(date) == 0;
}