Expire the owners cache after 1 minute and make it unlimited Change-Id: I64ecf6d4b721cec0185d79cbc30c94b291d763dc
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 c2ec085..295c670 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
@@ -25,6 +25,7 @@ import com.google.inject.Inject; import com.google.inject.Module; import com.google.inject.Singleton; +import java.time.Duration; import java.util.Objects; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; @@ -36,7 +37,9 @@ return new CacheModule() { @Override protected void configure() { - cache(CACHE_NAME, Key.class, PathOwnersEntry.class); + cache(CACHE_NAME, Key.class, PathOwnersEntry.class) + .maximumWeight(Long.MAX_VALUE) + .expireAfterWrite(Duration.ofSeconds(60)); bind(PathOwnersEntriesCache.class).to(PathOwnersEntriesCacheImpl.class); DynamicSet.bind(binder(), GitReferenceUpdatedListener.class) .to(OwnersRefUpdateListener.class);