Search in sources :

Example 1 with LocalObjectCache

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();
    }
}
Also used : LocalVersionCache(com.evolveum.midpoint.repo.cache.local.LocalVersionCache) LocalQueryCache(com.evolveum.midpoint.repo.cache.local.LocalQueryCache) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) LocalObjectCache(com.evolveum.midpoint.repo.cache.local.LocalObjectCache) CacheInvalidationContext(com.evolveum.midpoint.CacheInvalidationContext)

Example 2 with LocalObjectCache

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);
}
Also used : GlobalQueryCache(com.evolveum.midpoint.repo.cache.global.GlobalQueryCache) GlobalVersionCache(com.evolveum.midpoint.repo.cache.global.GlobalVersionCache) LocalVersionCache(com.evolveum.midpoint.repo.cache.local.LocalVersionCache) LocalQueryCache(com.evolveum.midpoint.repo.cache.local.LocalQueryCache) LocalObjectCache(com.evolveum.midpoint.repo.cache.local.LocalObjectCache) GlobalObjectCache(com.evolveum.midpoint.repo.cache.global.GlobalObjectCache)

Example 3 with LocalObjectCache

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);
            }
        }
    }
}
Also used : QUERY_RESULT_SIZE_LIMIT(com.evolveum.midpoint.repo.cache.handlers.SearchOpHandler.QUERY_RESULT_SIZE_LIMIT) LocalVersionCache(com.evolveum.midpoint.repo.cache.local.LocalVersionCache) LocalRepoCacheCollection.getLocalVersionCache(com.evolveum.midpoint.repo.cache.local.LocalRepoCacheCollection.getLocalVersionCache) LocalRepoCacheCollection.getLocalObjectCache(com.evolveum.midpoint.repo.cache.local.LocalRepoCacheCollection.getLocalObjectCache) LocalObjectCache(com.evolveum.midpoint.repo.cache.local.LocalObjectCache)

Aggregations

LocalObjectCache (com.evolveum.midpoint.repo.cache.local.LocalObjectCache)3 LocalVersionCache (com.evolveum.midpoint.repo.cache.local.LocalVersionCache)3 LocalQueryCache (com.evolveum.midpoint.repo.cache.local.LocalQueryCache)2 CacheInvalidationContext (com.evolveum.midpoint.CacheInvalidationContext)1 GlobalObjectCache (com.evolveum.midpoint.repo.cache.global.GlobalObjectCache)1 GlobalQueryCache (com.evolveum.midpoint.repo.cache.global.GlobalQueryCache)1 GlobalVersionCache (com.evolveum.midpoint.repo.cache.global.GlobalVersionCache)1 QUERY_RESULT_SIZE_LIMIT (com.evolveum.midpoint.repo.cache.handlers.SearchOpHandler.QUERY_RESULT_SIZE_LIMIT)1 LocalRepoCacheCollection.getLocalObjectCache (com.evolveum.midpoint.repo.cache.local.LocalRepoCacheCollection.getLocalObjectCache)1 LocalRepoCacheCollection.getLocalVersionCache (com.evolveum.midpoint.repo.cache.local.LocalRepoCacheCollection.getLocalVersionCache)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1