org.infinispan.quarkus.hibernate.cache.DomainDataRegionImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-local-cache Show documentation
Show all versions of quarkus-local-cache Show documentation
Local-only Hibernate Cache optimized for Quarkus
package org.infinispan.quarkus.hibernate.cache;
import org.hibernate.cache.cfg.spi.*;
import org.hibernate.cache.spi.CacheKeysFactory;
import org.hibernate.cache.spi.DomainDataRegion;
import org.hibernate.cache.spi.ExtendedStatisticsSupport;
import org.hibernate.cache.spi.RegionFactory;
import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.cache.spi.access.CollectionDataAccess;
import org.hibernate.cache.spi.access.EntityDataAccess;
import org.hibernate.cache.spi.access.NaturalIdDataAccess;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.stat.CacheRegionStatistics;
import org.jboss.logging.Logger;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Predicate;
final class DomainDataRegionImpl implements DomainDataRegion, ExtendedStatisticsSupport {
private static final Logger log = Logger.getLogger(DomainDataRegionImpl.class);
private final InternalCache cache;
private final DomainDataRegionConfig config;
private final CacheKeysFactory cacheKeysFactory;
private final RegionFactory regionFactory;
private final InternalRegion internalRegion;
private Strategy strategy;
private PutFromLoadValidator validator;
private Predicate filter;
@Override
public long getElementCountInMemory() {
return cache.size(filter);
}
@Override
public long getElementCountOnDisk() {
return CacheRegionStatistics.NO_EXTENDED_STAT_SUPPORT_RETURN;
}
@Override
public long getSizeInMemory() {
return CacheRegionStatistics.NO_EXTENDED_STAT_SUPPORT_RETURN;
}
private enum Strategy {
VALIDATION, VERSIONED_ENTRIES
}
DomainDataRegionImpl(InternalCache cache, DomainDataRegionConfig config, CacheKeysFactory cacheKeysFactory, RegionFactory regionFactory) {
this.cache = cache;
this.config = config;
this.cacheKeysFactory = cacheKeysFactory;
this.regionFactory = regionFactory;
this.internalRegion = new InternalRegionImpl(this);
}
CacheKeysFactory getCacheKeysFactory() {
return cacheKeysFactory;
}
@Override
public EntityDataAccess getEntityDataAccess(NavigableRole rootEntityRole) {
EntityDataCachingConfig entityConfig = findConfig(config.getEntityCaching(), rootEntityRole);
AccessType accessType = entityConfig.getAccessType();
Comparator
© 2015 - 2025 Weber Informatics LLC | Privacy Policy