Search in sources :

Example 1 with ObjectMapReplayDecoder

use of org.redisson.client.protocol.decoder.ObjectMapReplayDecoder in project redisson by redisson.

the class RedissonBloomFilter method count.

@Override
public long count() {
    CommandBatchService executorService = new CommandBatchService(commandExecutor);
    RFuture<Map<String, String>> configFuture = executorService.readAsync(configName, StringCodec.INSTANCE, new RedisCommand<Map<Object, Object>>("HGETALL", new ObjectMapReplayDecoder()), configName);
    RBitSetAsync bs = createBitSet(executorService);
    RFuture<Long> cardinalityFuture = bs.cardinalityAsync();
    executorService.execute();
    readConfig(configFuture.getNow());
    return Math.round(-size / ((double) hashIterations) * Math.log(1 - cardinalityFuture.getNow() / ((double) size)));
}
Also used : RBitSetAsync(org.redisson.api.RBitSetAsync) ObjectMapReplayDecoder(org.redisson.client.protocol.decoder.ObjectMapReplayDecoder) CommandBatchService(org.redisson.command.CommandBatchService) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 RBitSetAsync (org.redisson.api.RBitSetAsync)1 ObjectMapReplayDecoder (org.redisson.client.protocol.decoder.ObjectMapReplayDecoder)1 CommandBatchService (org.redisson.command.CommandBatchService)1