|
|
|
@ -25,6 +25,7 @@ import java.util.Set;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
import org.redisson.api.RFuture;
|
|
|
|
|
import org.redisson.api.RLock;
|
|
|
|
|
import org.redisson.api.RSetCache;
|
|
|
|
|
import org.redisson.api.RedissonClient;
|
|
|
|
|
import org.redisson.api.mapreduce.RCollectionMapReduce;
|
|
|
|
@ -37,6 +38,7 @@ import org.redisson.client.protocol.decoder.ScanObjectEntry;
|
|
|
|
|
import org.redisson.command.CommandAsyncExecutor;
|
|
|
|
|
import org.redisson.eviction.EvictionScheduler;
|
|
|
|
|
import org.redisson.mapreduce.RedissonCollectionMapReduce;
|
|
|
|
|
import org.redisson.misc.Hash;
|
|
|
|
|
import org.redisson.misc.RedissonPromise;
|
|
|
|
|
|
|
|
|
|
import io.netty.buffer.ByteBuf;
|
|
|
|
@ -351,4 +353,19 @@ public class RedissonSetCache<V> extends RedissonExpirable implements RSetCache<
|
|
|
|
|
delete();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getLockName(Object value) {
|
|
|
|
|
ByteBuf state = encode(value);
|
|
|
|
|
try {
|
|
|
|
|
return suffixName(getName(value), Hash.hash128toBase64(state) + ":lock");
|
|
|
|
|
} finally {
|
|
|
|
|
state.release();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RLock getLock(V value) {
|
|
|
|
|
String lockName = getLockName(value);
|
|
|
|
|
return new RedissonLock(commandExecutor, lockName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|