fix caching
This commit is contained in:
1 parent
79f9de9de4
commit
0fc7fa557d
4 files changed
+91
-60
No files matched your search
+7
-1
@@ -23,6 +23,7 @@ import org.keycloak.models.ProtocolMapperModel;
|
||||
import org.keycloak.models.RealmModel;
|
||||
import org.keycloak.models.RoleContainerModel;
|
||||
import org.keycloak.models.RoleModel;
|
||||
import org.keycloak.models.cache.CachedObject;
|
||||
import org.keycloak.models.cache.infinispan.entities.CachedClient;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
@@ -36,7 +37,7 @@ import java.util.Set;
|
||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class ClientAdapter implements ClientModel {
|
||||
public class ClientAdapter implements ClientModel, CachedObject {
|
||||
protected RealmCacheSession cacheSession;
|
||||
protected RealmModel cachedRealm;
|
||||
|
||||
@@ -69,6 +70,11 @@ public class ClientAdapter implements ClientModel {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCacheTimestamp() {
|
||||
return cached.getCacheTimestamp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateClient() {
|
||||
if (updated != null) updated.updateClient();
|
||||
|
||||
+8
-2
@@ -1336,8 +1336,14 @@ public class RealmAdapter implements CachedRealmModel {
|
||||
|
||||
public void executeEvictions(ComponentModel model) {
|
||||
if (model == null) return;
|
||||
// test that this is a realm component
|
||||
if (model.getParentId() != null && !model.getParentId().equals(getId())) return;
|
||||
// If not realm component, check to see if it is a user storage provider child component (i.e. LDAP mapper)
|
||||
if (model.getParentId() != null && !model.getParentId().equals(getId())) {
|
||||
ComponentModel parent = getComponent(model.getParentId());
|
||||
if (parent != null && UserStorageProvider.class.getName().equals(parent.getProviderType())) {
|
||||
session.userCache().evict(this);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// invalidate entire user cache if we're dealing with user storage SPI
|
||||
if (UserStorageProvider.class.getName().equals(model.getProviderType())) {
|
||||
|
||||
Reference in new issue
Block a user