
org.infinispan.quarkus.hibernate.cache.VersionedEntry Maven / Gradle / Ivy
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 {
static final Logger log = Logger.getLogger(VersionedEntry.class);
static final boolean trace = log.isTraceEnabled();
public static final Duration TOMBSTONE_LIFESPAN = Duration.ofSeconds(60);
static final ExcludeEmptyFilter EXCLUDE_EMPTY_VERSIONED_ENTRY = new ExcludeEmptyFilter();
final Object value;
final Object version;
final long timestamp;
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