Remove CacheBackend from ChronicleMapCacheFactory

Adapt to the removal of CacheBackend carried on by change I27e182f964c.

Bug: Issue 15647
Change-Id: Ibf2fc2c9d6933da66c2f0c920e003062448e7506
diff --git a/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheFactory.java b/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheFactory.java
index e1eb5ab..a51fd36 100644
--- a/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheFactory.java
+++ b/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheFactory.java
@@ -21,7 +21,6 @@
 import com.google.gerrit.extensions.events.LifecycleListener;
 import com.google.gerrit.extensions.registration.DynamicMap;
 import com.google.gerrit.metrics.MetricMaker;
-import com.google.gerrit.server.cache.CacheBackend;
 import com.google.gerrit.server.cache.MemoryCacheFactory;
 import com.google.gerrit.server.cache.PersistentCacheBaseFactory;
 import com.google.gerrit.server.cache.PersistentCacheDef;
@@ -83,24 +82,20 @@
   }
 
   @Override
-  public <K, V> Cache<K, V> buildImpl(
-      PersistentCacheDef<K, V> in, long limit, CacheBackend backend) {
+  public <K, V> Cache<K, V> buildImpl(PersistentCacheDef<K, V> in, long limit) {
     ChronicleMapCacheConfig config =
         configFactory.create(
             in.configKey(),
             fileName(cacheDir, in.name(), in.version()),
             in.expireAfterWrite(),
             in.refreshAfterWrite());
-    return build(in, backend, config, metricMaker);
+    return build(in, config, metricMaker);
   }
 
   @SuppressWarnings("unchecked")
   @VisibleForTesting
   <K, V> Cache<K, V> build(
-      PersistentCacheDef<K, V> in,
-      CacheBackend backend,
-      ChronicleMapCacheConfig config,
-      MetricMaker metricMaker) {
+      PersistentCacheDef<K, V> in, ChronicleMapCacheConfig config, MetricMaker metricMaker) {
     ChronicleMapCacheDefProxy<K, V> def = new ChronicleMapCacheDefProxy<>(in);
 
     ChronicleMapCacheImpl<K, V> cache;
@@ -114,7 +109,7 @@
 
       LoadingCache<K, TimedValue<V>> mem =
           (LoadingCache<K, TimedValue<V>>)
-              memCacheFactory.build(def, (CacheLoader<K, V>) memLoader, backend);
+              memCacheFactory.build(def, (CacheLoader<K, V>) memLoader);
 
       cache =
           new ChronicleMapCacheImpl<>(
@@ -136,14 +131,14 @@
 
   @Override
   public <K, V> LoadingCache<K, V> buildImpl(
-      PersistentCacheDef<K, V> in, CacheLoader<K, V> loader, long limit, CacheBackend backend) {
+      PersistentCacheDef<K, V> in, CacheLoader<K, V> loader, long limit) {
     ChronicleMapCacheConfig config =
         configFactory.create(
             in.configKey(),
             fileName(cacheDir, in.name(), in.version()),
             in.expireAfterWrite(),
             in.refreshAfterWrite());
-    return build(in, loader, backend, config, metricMaker);
+    return build(in, loader, config, metricMaker);
   }
 
   @SuppressWarnings("unchecked")
@@ -151,7 +146,6 @@
   public <K, V> LoadingCache<K, V> build(
       PersistentCacheDef<K, V> in,
       CacheLoader<K, V> loader,
-      CacheBackend backend,
       ChronicleMapCacheConfig config,
       MetricMaker metricMaker) {
     ChronicleMapCacheImpl<K, V> cache;
@@ -167,7 +161,7 @@
 
       LoadingCache<K, TimedValue<V>> mem =
           (LoadingCache<K, TimedValue<V>>)
-              memCacheFactory.build(def, (CacheLoader<K, V>) memLoader, backend);
+              memCacheFactory.build(def, (CacheLoader<K, V>) memLoader);
 
       cache =
           new ChronicleMapCacheImpl<>(
diff --git a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheIT.java b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheIT.java
index 444762b..872503c 100644
--- a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheIT.java
+++ b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheIT.java
@@ -22,7 +22,6 @@
 import com.google.gerrit.acceptance.UseLocalDisk;
 import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.api.accounts.AccountInput;
-import com.google.gerrit.server.cache.CacheBackend;
 import com.google.gerrit.server.cache.PersistentCacheFactory;
 import com.google.inject.Inject;
 import org.junit.Test;
@@ -47,8 +46,7 @@
   public void shouldBuildInMemoryCacheWhenDiskLimitIsNegative() {
     final int negativeDiskLimit = -1;
     final Cache<String, String> cache =
-        persistentCacheFactory.build(
-            new TestPersistentCacheDef("foo", null, negativeDiskLimit, 0), CacheBackend.CAFFEINE);
+        persistentCacheFactory.build(new TestPersistentCacheDef("foo", null, negativeDiskLimit, 0));
 
     assertThat(cache.getClass().getSimpleName()).isEqualTo("CaffeinatedGuavaCache");
   }
@@ -58,8 +56,7 @@
     final int positiveDiskLimit = 1024;
     assertThat(
             persistentCacheFactory.build(
-                new TestPersistentCacheDef("foo", null, positiveDiskLimit, ZERO_INMEMORY_CACHE),
-                CacheBackend.CAFFEINE))
+                new TestPersistentCacheDef("foo", null, positiveDiskLimit, ZERO_INMEMORY_CACHE)))
         .isInstanceOf(ChronicleMapCacheImpl.class);
   }
 
diff --git a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheTest.java b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheTest.java
index 91ddbe3..3af507c 100644
--- a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheTest.java
+++ b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheTest.java
@@ -25,7 +25,6 @@
 import com.google.gerrit.common.Nullable;
 import com.google.gerrit.metrics.DisabledMetricMaker;
 import com.google.gerrit.metrics.MetricMaker;
-import com.google.gerrit.server.cache.CacheBackend;
 import com.google.gerrit.server.cache.MemoryCacheFactory;
 import com.google.gerrit.server.cache.serialize.CacheSerializer;
 import com.google.gerrit.server.cache.serialize.StringCacheSerializer;
@@ -562,11 +561,10 @@
 
     if (withLoader) {
       return (ChronicleMapCacheImpl<String, String>)
-          cacheFactory.build(
-              cacheDef, cacheDef.loader(), CacheBackend.CAFFEINE, config, metricMaker);
+          cacheFactory.build(cacheDef, cacheDef.loader(), config, metricMaker);
     }
     return (ChronicleMapCacheImpl<String, String>)
-        cacheFactory.build(cacheDef, CacheBackend.CAFFEINE, config, metricMaker);
+        cacheFactory.build(cacheDef, config, metricMaker);
   }
 
   private ChronicleMapCacheImpl<String, String> newCacheWithLoader(@Nullable String loadedValue) {