org.babyfish.jimmer.sql.cache.chain.ParameterizedLockedSimpleBinder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jimmer-sql Show documentation
Show all versions of jimmer-sql Show documentation
A revolutionary ORM framework for both java and kotlin
package org.babyfish.jimmer.sql.cache.chain;
import org.babyfish.jimmer.meta.ImmutableProp;
import org.babyfish.jimmer.meta.ImmutableType;
import org.babyfish.jimmer.sql.cache.CacheLocker;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.time.Duration;
import java.util.Collection;
import java.util.Map;
import java.util.SortedMap;
class ParameterizedLockedSimpleBinder implements SimpleBinder.Parameterized, LockedBinder {
private final LockableBinder.Parameterized raw;
private final CacheLocker locker;
private final Duration waitDuration;
private final Duration leaseDuration;
@SuppressWarnings("unchecked")
ParameterizedLockedSimpleBinder(
LockableBinder.Parameterized raw,
CacheLocker locker,
Duration waitDuration,
Duration leaseDuration
) {
if (raw instanceof LockedBinder) {
raw = (LockableBinder.Parameterized)((LockedBinder) raw).unwrap();
}
this.raw = raw;
this.locker = locker;
this.waitDuration = waitDuration;
this.leaseDuration = leaseDuration;
}
@Override
public LockableBinder.Parameterized unwrap() {
return raw;
}
@Override
public CacheLocker locker() {
return locker;
}
@Override
public Duration waitDuration() {
return waitDuration;
}
@Override
public Duration leaseDuration() {
return leaseDuration;
}
@Override
public @Nullable ImmutableType type() {
return raw.type();
}
@Override
public @Nullable ImmutableProp prop() {
return raw.prop();
}
@Override
public @NotNull TrackingMode tracingMode() {
return raw.tracingMode();
}
@Override
public Map getAll(Collection keys, SortedMap parameterMap) {
return raw.getAll(keys, parameterMap);
}
@Override
public void setAll(Map map, SortedMap parameterMap) {
raw.setAll(map, parameterMap);
}
@Override
public void deleteAll(Collection keys, Object reason) {
raw.deleteAll(keys, reason);
}
}