Package orestes.bloomfilter.redis.helper

Examples of orestes.bloomfilter.redis.helper.RedisPool



    public BloomFilterRedis(FilterBuilder builder) {
        builder.complete();
        this.keys = new RedisKeys(builder.name());
        this.pool = new RedisPool(builder.redisHost(), builder.redisPort(), builder.redisConnections(), builder.getReadSlaves());
        this.bloom = new RedisBitSet(pool, keys.BITS_KEY, builder.size());
        this.config = keys.persistConfig(pool, builder);
        if (builder.overwriteIfExists())
            this.clear();
    }
View Full Code Here



    public CountingBloomFilterRedis(FilterBuilder builder) {
        builder.complete();
        this.keys = new RedisKeys(builder.name());
        this.pool = new RedisPool(builder.redisHost(), builder.redisPort(), builder.redisConnections(), builder.getReadSlaves());
        this.bloom = new RedisBitSet(pool, keys.BITS_KEY, builder.size());
        this.config = keys.persistConfig(pool, builder);
        if(builder.overwriteIfExists())
            this.clear();
    }
View Full Code Here

        redisBenchmark();
    }

    public static void redisBenchmark() {
        int connections = 100;
        RedisPool pool = new RedisPool("localhost", 6379, connections);
        ExecutorService exec = Executors.newFixedThreadPool(connections);

        int rounds = 200_000;
        int perThread = rounds / connections;
        CompletableFuture[] futures = new CompletableFuture[connections];
        Long start = System.currentTimeMillis();
        for (int i = 0; i < connections; i++) {
            futures[i] = CompletableFuture.runAsync(() -> {
                pool.safelyDo(jedis -> {
                    for(int j = 0; j < perThread; j++) {
                        jedis.set("key" + Math.random(), RandomStringUtils.random(50));
                    }
                });
            }, exec);
View Full Code Here

    public static Jedis getJedis() {
        return new Jedis(host, port);
    }

    public static RedisPool getPool() {
        return new RedisPool(host, port, connections, null);
    }
View Full Code Here

                    primes.set(j, false);
                }
            }
        }

        RedisPool pool = Helper.getPool();
        RedisBitSet bs = new RedisBitSet(pool, "test", primes.size());
        bs.overwriteBitSet(primes);
        BitSet read = bs.asBitSet();
        assertEquals(primes, read);
        assertEquals(primes, read);
View Full Code Here

        BitSet b1 = new BitSet();
        BitSet b2 = new BitSet();
        IntStream.range(0, 100).forEach(i -> b1.set(i*10, true));
        IntStream.range(0, 100).forEach(i -> b2.set(i*99, true));

        RedisPool pool = Helper.getPool();
        RedisBitSet rb1 = new RedisBitSet(pool, "b1", b1.size());
        rb1.overwriteBitSet(b1);
        RedisBitSet rb2 = new RedisBitSet(pool, "b2", b2.size());
        rb2.overwriteBitSet(b2);

View Full Code Here


    public BloomFilterRedis(FilterBuilder builder) {
        builder.complete();
        this.keys = new RedisKeys(builder.name());
        this.pool = new RedisPool(builder.redisHost(), builder.redisPort(), builder.redisConnections(), builder.getReadSlaves());
        this.bloom = new RedisBitSet(pool, keys.BITS_KEY, builder.size());
        this.config = keys.persistConfig(pool, builder);
        if (builder.overwriteIfExists())
            this.clear();
    }
View Full Code Here


    public CountingBloomFilterRedis(FilterBuilder builder) {
        builder.complete();
        this.keys = new RedisKeys(builder.name());
        this.pool = new RedisPool(builder.redisHost(), builder.redisPort(), builder.redisConnections(), builder.getReadSlaves());
        this.bloom = new RedisBitSet(pool, keys.BITS_KEY, builder.size());
        this.config = keys.persistConfig(pool, builder);
        if(builder.overwriteIfExists())
            this.clear();
    }
View Full Code Here

TOP

Related Classes of orestes.bloomfilter.redis.helper.RedisPool

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.