Merge pull request #3371 from brewers/bug/cache-dynamic-resource
KEYCLOAK-3752 : Include programmatically created resources in the resource cache
This commit is contained in:
commit
4bf5da8fac
1 changed files with 2 additions and 6 deletions
|
@ -108,14 +108,10 @@ public class CachedResourceStore implements ResourceStore {
|
|||
|
||||
@Override
|
||||
public List<Resource> findByOwner(String ownerId) {
|
||||
List<String> 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());
|
||||
}
|
||||
|
||||
return ((List<String>) this.cache.getOrDefault(getResourceOwnerCacheKey(ownerId), Collections.emptyList())).stream().map(this::findById)
|
||||
.filter(resource -> resource != null)
|
||||
|
|
Loading…
Reference in a new issue