Package redis.clients.jedis

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


    @Test
    public void multi() {
  Transaction trans = jedis.multi();

  trans.sadd("foo", "a");
  trans.sadd("foo", "b");
  trans.scard("foo");

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


    @Test
    public void multi() {
  Transaction trans = jedis.multi();

  trans.sadd("foo", "a");
  trans.sadd("foo", "b");
  trans.scard("foo");

  List<Object> response = trans.exec();

  List<Object> expected = new ArrayList<Object>();
View Full Code Here

  assertEquals(expected, response);

  // Binary
  trans = jedis.multi();

  trans.sadd(bfoo, ba);
  trans.sadd(bfoo, bb);
  trans.scard(bfoo);

  response = trans.exec();
View Full Code Here

  // Binary
  trans = jedis.multi();

  trans.sadd(bfoo, ba);
  trans.sadd(bfoo, bb);
  trans.scard(bfoo);

  response = trans.exec();

  expected = new ArrayList<Object>();
View Full Code Here

    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

        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

        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

        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

    @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

    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

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.