use of com.evolveum.midpoint.repo.cache.local.LocalObjectCache in project midpoint by Evolveum.
the class Invalidator method invalidateCacheEntries.
public <T extends ObjectType> void invalidateCacheEntries(Class<T> type, String oid, Object additionalInfo, OperationResult parentResult) {
OperationResult result = parentResult.subresult(CLASS_NAME_WITH_DOT + "invalidateCacheEntries").setMinor().addParam("type", type).addParam("oid", oid).addParam("additionalInfo", additionalInfo != null ? additionalInfo.getClass().getSimpleName() : "none").build();
try {
LocalObjectCache localObjectCache = getLocalObjectCache();
if (localObjectCache != null) {
localObjectCache.remove(oid);
}
LocalVersionCache localVersionCache = getLocalVersionCache();
if (localVersionCache != null) {
localVersionCache.remove(oid);
}
LocalQueryCache localQueryCache = getLocalQueryCache();
if (localQueryCache != null) {
clearQueryResultsLocally(localQueryCache, type, oid, additionalInfo, matchingRuleRegistry);
}
boolean clusterwide = TYPES_ALWAYS_INVALIDATED_CLUSTERWIDE.contains(type) || globalObjectCache.hasClusterwideInvalidationFor(type) || globalVersionCache.hasClusterwideInvalidationFor(type) || globalQueryCache.hasClusterwideInvalidationFor(type);
cacheDispatcher.dispatchInvalidation(type, oid, clusterwide, new CacheInvalidationContext(false, new RepositoryCacheInvalidationDetails(additionalInfo)));
} catch (Throwable t) {
result.recordFatalError(t);
// Really? We want the operation to proceed anyway. But OTOH we want to be sure devel team gets notified about this.
throw t;
} finally {
result.computeStatusIfUnknown();
}
}
use of com.evolveum.midpoint.repo.cache.local.LocalObjectCache in project midpoint by Evolveum.
the class CacheSetAccessInfoFactory method determine.
private <T extends ObjectType> CacheSetAccessInfo<T> determine(Class<T> type, boolean alsoQuery) {
CacheAccessInfo<GlobalObjectCache, T> globalObject = new CacheAccessInfo<>(globalObjectCache, globalObjectCache.getConfiguration(), type, globalObjectCache.isAvailable());
CacheAccessInfo<GlobalVersionCache, T> globalVersion = new CacheAccessInfo<>(globalVersionCache, globalVersionCache.getConfiguration(), type, globalVersionCache.isAvailable());
CacheAccessInfo<GlobalQueryCache, T> globalQuery = alsoQuery ? new CacheAccessInfo<>(globalQueryCache, globalQueryCache.getConfiguration(), type, globalQueryCache.isAvailable()) : CacheAccessInfo.createNotAvailable();
LocalObjectCache localObjectCache = getLocalObjectCache();
LocalVersionCache localVersionCache = getLocalVersionCache();
LocalQueryCache localQueryCache = getLocalQueryCache();
CacheAccessInfo<LocalObjectCache, T> localObject = localObjectCache != null ? new CacheAccessInfo<>(localObjectCache, localObjectCache.getConfiguration(), type, true) : new CacheAccessInfo<>(null, cacheConfigurationManager.getConfiguration(LOCAL_REPO_OBJECT_CACHE), type, false);
CacheAccessInfo<LocalVersionCache, T> localVersion = localVersionCache != null ? new CacheAccessInfo<>(localVersionCache, localVersionCache.getConfiguration(), type, true) : new CacheAccessInfo<>(null, cacheConfigurationManager.getConfiguration(LOCAL_REPO_VERSION_CACHE), type, false);
CacheAccessInfo<LocalQueryCache, T> localQuery;
if (alsoQuery) {
localQuery = localQueryCache != null ? new CacheAccessInfo<>(localQueryCache, localQueryCache.getConfiguration(), type, true) : new CacheAccessInfo<>(null, cacheConfigurationManager.getConfiguration(LOCAL_REPO_QUERY_CACHE), type, false);
} else {
localQuery = CacheAccessInfo.createNotAvailable();
}
return new CacheSetAccessInfo<>(localObject, localVersion, localQuery, globalObject, globalVersion, globalQuery);
}
use of com.evolveum.midpoint.repo.cache.local.LocalObjectCache in project midpoint by Evolveum.
the class CacheUpdater method storeImmutableObjectsToObjectAndVersionLocal.
private <T extends ObjectType> void storeImmutableObjectsToObjectAndVersionLocal(List<PrismObject<T>> immutableObjects) {
LocalObjectCache localObjectCache = getLocalObjectCache();
if (localObjectCache != null) {
for (PrismObject<T> immutableObject : immutableObjects) {
Class<? extends ObjectType> type = immutableObject.asObjectable().getClass();
if (localObjectCache.supportsObjectType(type)) {
// no need to clone immutable object
localObjectCache.put(immutableObject);
}
}
}
LocalVersionCache localVersionCache = getLocalVersionCache();
if (localVersionCache != null) {
for (PrismObject<T> immutableObject : immutableObjects) {
Class<? extends ObjectType> type = immutableObject.asObjectable().getClass();
if (localVersionCache.supportsObjectType(type)) {
localVersionCache.put(immutableObject);
}
}
}
}
Aggregations