HyperLogLog

    @Test
    public void hyperLogLogTest() {
        int j = 0;
        long blogId = 123L;
        String redisKey = "uv:" + blogId;
        String[] userIds = new String[1000];
        for (int i = 0; i < 1000000; i++) {
            j = i % 1000;
            userIds[j] = "userid_" + i;
            if (j == 999) {
                stringRedisTemplate.opsForHyperLogLog().add(redisKey, userIds);
            }
        }
        //统计数量
        Long count = stringRedisTemplate.opsForHyperLogLog().size(redisKey);
        System.out.println("count == " + count);
    }

你可能感兴趣的:(java,jvm,html)