org.infinispan.quarkus.hibernate.cache.VersionedEntry 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.spi.entry.CacheEntry;
import org.hibernate.cache.spi.entry.StructuredCacheEntry;
import org.jboss.logging.Logger;
import java.time.Duration;
import java.util.Comparator;
import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Predicate;
final class VersionedEntry {
private static final Logger log = Logger.getLogger(VersionedEntry.class);
private static final boolean trace = log.isTraceEnabled();
public static final Duration TOMBSTONE_LIFESPAN = Duration.ofSeconds(60);
static final ExcludeEmptyFilter EXCLUDE_EMPTY_VERSIONED_ENTRY = new ExcludeEmptyFilter();
private final Object value;
private final Object version;
private final long timestamp;
private Duration lifespan = Duration.ofSeconds(Long.MAX_VALUE);
VersionedEntry(Object value, Object version, long timestamp) {
this.value = value;
this.version = version;
this.timestamp = timestamp;
}
VersionedEntry(long timestamp) {
this(null, null, timestamp);
}
VersionedEntry(long timestamp, Duration lifespan) {
this(null, null, timestamp);
this.lifespan = lifespan;
}
Object getVersion() {
return version;
}
long getTimestamp() {
return timestamp;
}
long getLifespanNanos() {
return lifespan.toNanos();
}
Object getValue() {
return value;
}
static final class ComputeFn implements BiFunction
© 2015 - 2025 Weber Informatics LLC | Privacy Policy