diff --git a/model/infinispan/src/main/java/org/keycloak/models/authorization/infinispan/CachedResourceStore.java b/model/infinispan/src/main/java/org/keycloak/models/authorization/infinispan/CachedResourceStore.java index f86de2f067..8696d8d11e 100644 --- a/model/infinispan/src/main/java/org/keycloak/models/authorization/infinispan/CachedResourceStore.java +++ b/model/infinispan/src/main/java/org/keycloak/models/authorization/infinispan/CachedResourceStore.java @@ -108,13 +108,9 @@ public class CachedResourceStore implements ResourceStore { @Override public List findByOwner(String ownerId) { - List cachedIds = this.cache.get(getResourceOwnerCacheKey(ownerId)); - if (cachedIds == null) { - for (Resource resource : getDelegate().findByOwner(ownerId)) { - updateCachedIds(getResourceOwnerCacheKey(ownerId), resource, true); - } - cachedIds = this.cache.getOrDefault(getResourceOwnerCacheKey(ownerId), Collections.emptyList()); + for (Resource resource : getDelegate().findByOwner(ownerId)) { + updateCachedIds(getResourceOwnerCacheKey(ownerId), resource, true); } return ((List) this.cache.getOrDefault(getResourceOwnerCacheKey(ownerId), Collections.emptyList())).stream().map(this::findById)