Package redis.clients.jedis

Examples of redis.clients.jedis.Jedis.hget()


        return hgetAll;
    }

    public String hget(String field) {
        Jedis jedis = getResource();
        String value = jedis.hget(key(), field);
        returnResource(jedis);
        return value;
    }

    public Long hdel(String field) {
View Full Code Here


    public Object hget(String key, String field) {
        Jedis jedis = null;
        try {
            jedis = this.jedisPool.getResource();
            byte[] value = jedis.hget(SafeEncoder.encode(key),
                    SafeEncoder.encode(field));
            LOG.info("hget key:" + key + " field:" + field);

            return deserialize(value);
        } catch (Exception e) {
View Full Code Here

            if (url == null) {
                return null;
            }
            String key = ITEM_PREFIX + task.getUUID();
            String field = DigestUtils.shaHex(url);
            byte[] bytes = jedis.hget(key.getBytes(), field.getBytes());
            if (bytes != null) {
                Request o = JSON.parseObject(new String(bytes), Request.class);
                return o;
            }
            Request request = new Request(url);
View Full Code Here

        }

        System.out.println();

        articleVote(conn, "other_user", "article:" + articleId);
        String votes = conn.hget("article:" + articleId, "votes");
        System.out.println("We voted for the article, it now has votes: " + votes);
        assert Integer.parseInt(votes) > 1;

        System.out.println("The currently highest-scoring articles are:");
        List<Map<String,String>> articles = getArticles(conn, 1);
View Full Code Here

   * @return       Returns true if the poll is retrieved otherwise false
   */
  public boolean retrievePoll(String webKey) {
    Jedis jedis = dbConnect();

    if (jedis.exists(webKey) && jedis.hget(jedis.get(webKey), "title") != null) {
      curWebKey = webKey;
     
      pollKey = jedis.get(webKey);
      title = jedis.hget(pollKey, "title");
      question = jedis.hget(pollKey, "question");
View Full Code Here

    if (jedis.exists(webKey) && jedis.hget(jedis.get(webKey), "title") != null) {
      curWebKey = webKey;
     
      pollKey = jedis.get(webKey);
      title = jedis.hget(pollKey, "title");
      question = jedis.hget(pollKey, "question");
      multiple = jedis.hget(pollKey, "multiple");
     
      long pollSize = jedis.hlen(pollKey);
      int otherFields = 10;
View Full Code Here

    if (jedis.exists(webKey) && jedis.hget(jedis.get(webKey), "title") != null) {
      curWebKey = webKey;
     
      pollKey = jedis.get(webKey);
      title = jedis.hget(pollKey, "title");
      question = jedis.hget(pollKey, "question");
      multiple = jedis.hget(pollKey, "multiple");
     
      long pollSize = jedis.hlen(pollKey);
      int otherFields = 10;
          long numAnswers = (pollSize-otherFields)/2;
View Full Code Here

      curWebKey = webKey;
     
      pollKey = jedis.get(webKey);
      title = jedis.hget(pollKey, "title");
      question = jedis.hget(pollKey, "question");
      multiple = jedis.hget(pollKey, "multiple");
     
      long pollSize = jedis.hlen(pollKey);
      int otherFields = 10;
          long numAnswers = (pollSize-otherFields)/2;
         
View Full Code Here

          long numAnswers = (pollSize-otherFields)/2;
         
          answers  = new ArrayList <String>();
         
          for (int j = 1; j <= numAnswers; j++) {
            answers.add(jedis.hget(pollKey, "answer"+j+"text"));
          }
         
          return true;
    } else
      return false;
View Full Code Here

    public Object hget(String key, String field) {
        Jedis jedis = null;
        try {
            jedis = this.jedisPool.getResource();
            byte[] value = jedis.hget(SafeEncoder.encode(key),
                    SafeEncoder.encode(field));
            LOG.info("hget key:" + key + " field:" + field);

            return deserialize(value);
        } catch (Exception 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.