Examples of sadd()


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

    public int indexDocument(Jedis conn, String docid, String content) {
        Set<String> words = tokenize(content);
        Transaction trans = conn.multi();
        for (String word : words) {
            trans.sadd("idx:" + word, docid);
        }
        return trans.exec().size();
    }

    private String setCommon(
View Full Code Here

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

        String content, Ecpm type, double value)
    {
        Transaction trans = conn.multi();

        for (String location : locations) {
            trans.sadd("idx:req:" + location, id);
        }

        Set<String> words = tokenize(content);
        for (String word : tokenize(content)) {
            trans.zadd("idx:" + word, 0, id);
View Full Code Here

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

        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();
    }

    public double toEcpm(Ecpm type, double views, double avg, double value) {
View Full Code Here

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

        Transaction trans = conn.multi();
        terms.addAll(words);
        if (terms.size() > 0) {
            String matchedKey = "terms:matched:" + targetId;
            for (String term : terms) {
                trans.sadd(matchedKey, term);
            }
            trans.expire(matchedKey, 900);
        }

        trans.incr("type:" + type + ":views:");
View Full Code Here

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

    @SuppressWarnings("unchecked")
    public boolean isQualified(Jedis conn, String jobId, String... candidateSkills) {
        String temp = UUID.randomUUID().toString();
        Transaction trans = conn.multi();
        for(String skill : candidateSkills) {
            trans.sadd(temp, skill);
        }
        trans.expire(temp, 5);
        trans.sdiff("job:" + jobId, temp);

        List<Object> response = trans.exec();
View Full Code Here

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

    public void indexJob(Jedis conn, String jobId, String... skills) {
        Transaction trans = conn.multi();
        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();
    }
View Full Code Here

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

            }

            Transaction trans = conn.multi();
            trans.hincrBy(seller, "funds", (int)price);
            trans.hincrBy(buyer, "funds", (int)-price);
            trans.sadd(inventory, itemId);
            trans.zrem("market:", item);
            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.sadd()

            final String endpointToken = channel.getEndpointToken();
            final Transaction tx = jedis.multi();
            tx.set(endpointToken, Long.toString(channel.getVersion()));
            tx.set(tokenLookupKey(endpointToken), chid);
            tx.hmset(chidLookupKey(chid), mapOf(endpointToken, uaid));
            tx.sadd(uaidLookupKey(uaid), chid);
            tx.exec();
            return true;
        } finally {
            jedisPool.returnResource(jedis);
        }
View Full Code Here

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

            byte[] object = RedisSerializationUtil.encode((Serializable) value);
            transaction.set(attributeKey.getBytes(RedisSessionKeys.getEncoding()), object);
            transaction.expireAt(attributeKey.getBytes(RedisSessionKeys.getEncoding()), getUnixTime(currentExpireAtTimeWithReserve));

            transaction.sadd(attrsListKey, name);
            transaction.expireAt(attrsListKey, getUnixTime(currentExpireAtTimeWithReserve));

            transaction.exec();

            pool.returnResource(jedis);
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.