Examples of zadd()


Examples of redis.clients.jedis.Transaction.zadd()

        double avg = AVERAGE_PER_1K.containsKey(type) ? AVERAGE_PER_1K.get(type) : 1;
        double rvalue = toEcpm(type, 1000, avg, value);

        trans.hset("type:", id, type.name().toLowerCase());
        trans.zadd("idx:ad:value:", rvalue, id);
        trans.zadd("ad:base_value:", value, id);
        for (String word : words){
            trans.sadd("terms:" + id, word);
        }
        trans.exec();
    }
View Full Code Here

Examples of redis.clients.jedis.Transaction.zadd()

        Set<String> unique = new HashSet<String>();
        for (String skill : skills) {
            trans.sadd("idx:skill:" + skill, jobId);
            unique.add(skill);
        }
        trans.zadd("idx:jobs:req", unique.size(), jobId);
        trans.exec();
    }

    public Set<String> findJobs(Jedis conn, String... candidateSkills) {
        String[] keys = new String[candidateSkills.length];
View Full Code Here

Examples of redis.clients.jedis.Transaction.zadd()

    public void updateCounter(Jedis conn, String name, int count, long now){
        Transaction trans = conn.multi();
        for (int prec : PRECISION) {
            long pnow = (now / prec) * prec;
            String hash = String.valueOf(prec) + ':' + name;
            trans.zadd("known:", 0, hash);
            trans.hincrBy("count:" + hash, String.valueOf(pnow), count);
        }
        trans.exec();
    }

View Full Code Here

Examples of redis.clients.jedis.Transaction.zadd()

                trans.set(startKey, hourStart);
            }

            String tkey1 = UUID.randomUUID().toString();
            String tkey2 = UUID.randomUUID().toString();
            trans.zadd(tkey1, value, "min");
            trans.zadd(tkey2, value, "max");

            trans.zunionstore(
                destination,
                new ZParams().aggregate(ZParams.Aggregate.MIN),
View Full Code Here

Examples of redis.clients.jedis.Transaction.zadd()

            }

            String tkey1 = UUID.randomUUID().toString();
            String tkey2 = UUID.randomUUID().toString();
            trans.zadd(tkey1, value, "min");
            trans.zadd(tkey2, value, "max");

            trans.zunionstore(
                destination,
                new ZParams().aggregate(ZParams.Aggregate.MIN),
                destination, tkey1);
View Full Code Here

Examples of redis.clients.jedis.Transaction.zadd()

            long delta = System.currentTimeMillis() - start;
            List<Object> stats = updateStats(conn, context, "AccessTime", delta / 1000.0);
            double average = (Double)stats.get(1) / (Double)stats.get(0);

            Transaction trans = conn.multi();
            trans.zadd("slowest:AccessTime", average, context);
            trans.zremrangeByRank("slowest:AccessTime", 0, -101);
            trans.exec();
        }
    }
}
View Full Code Here

Examples of redis.clients.jedis.Transaction.zadd()

                conn.unwatch();
                return false;
            }

            Transaction trans = conn.multi();
            trans.zadd("market:", price, item);
            trans.srem(inventory, itemId);
            List<Object> results = trans.exec();
            // null response indicates that the transaction was aborted due to
            // the watched key changing.
            if (results == null){
View Full Code Here

Examples of redis.clients.jedis.Transaction.zadd()

            transaction.expireAt(creationTimeKey, getUnixTime(expireAtTimeWithReserve));
            transaction.expireAt(lastAccessTimeKey, getUnixTime(expireAtTime));
            transaction.expireAt(expiresAtKey, getUnixTime(expireAtTimeWithReserve));
            transaction.expireAt(timeoutKey, getUnixTime(expireAtTimeWithReserve));

            transaction.zadd(sessionsKey, currentTime, id);

            transaction.exec();

            pool.returnResource(jedis);
        } catch (Throwable e) {
View Full Code Here

Examples of redis.clients.jedis.Transaction.zadd()

                transaction.rename(oldAttrsKey, newAttrsKey);
            } else {
                transaction.del(oldAttrsKey);
            }

            transaction.zadd(RedisSessionKeys.getSessionsKey(), lastAccessTime, id);
            transaction.zrem(RedisSessionKeys.getSessionsKey(), this.id);

            transaction.exec();

            pool.returnResource(jedis);
View Full Code Here

Examples of redis.clients.jedis.Transaction.zadd()

            }

            transaction.set(lastAccessTimeKey, Long.toString(currentTime));
            transaction.expireAt(lastAccessTimeKey, getUnixTime(expireAtTime));

            transaction.zadd(RedisSessionKeys.getSessionsKey(), currentTime, id);

            transaction.exec();

            pool.returnResource(jedis);
        } catch (Throwable e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.