Use PerThreadProjectCache instead of PerThreadCache
After I1090446b65 change, PerThreadCache won't be limiting the cache
entries. Since the usage of per thread cache in code-owners is specific
to projects, use PerThreadProjectCache instead.
Change-Id: I2cf7a0da2eb5f75f79edbace420ce7f916bf4653
Release-Notes: skip
diff --git a/java/com/google/gerrit/plugins/codeowners/backend/config/CodeOwnersPluginConfiguration.java b/java/com/google/gerrit/plugins/codeowners/backend/config/CodeOwnersPluginConfiguration.java
index a216eb1..cb565c5 100644
--- a/java/com/google/gerrit/plugins/codeowners/backend/config/CodeOwnersPluginConfiguration.java
+++ b/java/com/google/gerrit/plugins/codeowners/backend/config/CodeOwnersPluginConfiguration.java
@@ -18,6 +18,7 @@
import com.google.gerrit.entities.Project;
import com.google.gerrit.server.cache.PerThreadCache;
+import com.google.gerrit.server.cache.PerThreadProjectCache;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -69,8 +70,9 @@
*/
public CodeOwnersPluginProjectConfigSnapshot getProjectConfig(Project.NameKey projectName) {
requireNonNull(projectName, "projectName");
- return PerThreadCache.getOrCompute(
- PerThreadCache.Key.create(CodeOwnersPluginProjectConfigSnapshot.class, projectName),
+ return PerThreadProjectCache.getOrCompute(
+ PerThreadCache.Key.create(
+ Project.NameKey.class, projectName, "CodeOwnersPluginConfiguration"),
() -> codeOwnersPluginProjectConfigSnapshotFactory.create(projectName));
}
}