Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright (c) 2013-2021 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.lontime.shaded.org.redisson;
import io.netty.buffer.ByteBuf;
import com.github.lontime.shaded.org.redisson.api.RFuture;
import com.github.lontime.shaded.org.redisson.api.RSet;
import com.github.lontime.shaded.org.redisson.api.RSetMultimap;
import com.github.lontime.shaded.org.redisson.client.codec.Codec;
import com.github.lontime.shaded.org.redisson.client.protocol.RedisCommand;
import com.github.lontime.shaded.org.redisson.client.protocol.RedisCommands;
import com.github.lontime.shaded.org.redisson.client.protocol.RedisStrictCommand;
import com.github.lontime.shaded.org.redisson.client.protocol.convertor.BooleanAmountReplayConvertor;
import com.github.lontime.shaded.org.redisson.client.protocol.convertor.BooleanReplayConvertor;
import com.github.lontime.shaded.org.redisson.command.CommandAsyncExecutor;
import com.github.lontime.shaded.org.redisson.misc.CompletableFutureWrapper;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
/**
* @author Nikita Koksharov
*
* @param key
* @param value
*/
public class RedissonSetMultimap extends RedissonMultimap implements RSetMultimap {
private static final RedisStrictCommand SCARD_VALUE = new RedisStrictCommand("SCARD", new BooleanAmountReplayConvertor());
private static final RedisCommand SISMEMBER_VALUE = new RedisCommand("SISMEMBER", new BooleanReplayConvertor());
public RedissonSetMultimap(CommandAsyncExecutor connectionManager, String name) {
super(connectionManager, name);
}
public RedissonSetMultimap(Codec codec, CommandAsyncExecutor connectionManager, String name) {
super(codec, connectionManager, name);
}
@Override
public RFuture sizeAsync() {
return commandExecutor.evalReadAsync(getRawName(), codec, RedisCommands.EVAL_INTEGER,
"local keys = redis.call('hgetall', KEYS[1]); " +
"local size = 0; " +
"for i, v in ipairs(keys) do " +
"if i % 2 == 0 then " +
"local name = ARGV[1] .. v; " +
"size = size + redis.call('scard', name); " +
"end;" +
"end; " +
"return size; ",
Arrays.