Merge branch 'stable-3.4' into stable-3.5

* stable-3.4:
  Expire the owners cache after 1 minute and make it unlimited
  Optimize the 'path_owners_entries' cache eviction
  Introduce PathOwners cache from Ic7d61de07

Change-Id: I038f21524b7df93422b0ccd0f95afc5b9819828a
diff --git a/owners-common/src/main/java/com/googlesource/gerrit/owners/common/PathOwnersEntriesCache.java b/owners-common/src/main/java/com/googlesource/gerrit/owners/common/PathOwnersEntriesCache.java
index 04afebd..cc482fe 100644
--- a/owners-common/src/main/java/com/googlesource/gerrit/owners/common/PathOwnersEntriesCache.java
+++ b/owners-common/src/main/java/com/googlesource/gerrit/owners/common/PathOwnersEntriesCache.java
@@ -26,6 +26,7 @@
 import com.google.inject.Module;
 import com.google.inject.Singleton;
 import com.google.inject.TypeLiteral;
+import java.time.Duration;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.concurrent.Callable;
@@ -38,7 +39,9 @@
     return new CacheModule() {
       @Override
       protected void configure() {
-        cache(CACHE_NAME, Key.class, new TypeLiteral<Optional<OwnersConfig>>() {});
+        cache(CACHE_NAME, Key.class, new TypeLiteral<Optional<OwnersConfig>>() {})
+            .maximumWeight(Long.MAX_VALUE)
+            .expireAfterWrite(Duration.ofSeconds(60));
         bind(PathOwnersEntriesCache.class).to(PathOwnersEntriesCacheImpl.class);
         DynamicSet.bind(binder(), GitReferenceUpdatedListener.class)
             .to(OwnersRefUpdateListener.class);