Package redis.clients.jedis

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


  (new Thread(new Runnable() {
      public void run() {
    try {
        Thread.sleep(100);
        Jedis j = createJedis();
        j.lpush("foo", "a");
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
      }
  })).start();
View Full Code Here


  (new Thread(new Runnable() {
      public void run() {
    try {
        Thread.sleep(100);
        Jedis j = createJedis();
        j.lpush("foo", "a");
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
      }
  })).start();
View Full Code Here

        Jedis jedis = null;
        try {
            jedis = this.jedisPool.getResource();

            long begin = System.currentTimeMillis();
            jedis.lpush(SafeEncoder.encode(key), jsonSerialize(value));
            long end = System.currentTimeMillis();
            LOG.info("lpush key:" + key + " spends: " + (end - begin)
                    + " millionseconds.");
        } catch (Exception e) {
            LOG.error(e.getMessage(), e);
View Full Code Here

            logger.info("Creating paste with itemId: " + tokenId + " pasteIndex: " + pasteIndex);
            ds.insert(item);

            if(!item.isPrivate()) {
                System.out.println("ITEM IS NOT PRIVATE");
                jedis.lpush("pasteHistory", "" + pasteIndex);
                byte[] packedEntry = packEntry(item);
                System.out.println(new String(packedEntry));
                jedis.rpop("pasteHistoryCache".getBytes());
                jedis.lpush("pasteHistoryCache".getBytes(), packedEntry);
            }
View Full Code Here

                System.out.println("ITEM IS NOT PRIVATE");
                jedis.lpush("pasteHistory", "" + pasteIndex);
                byte[] packedEntry = packEntry(item);
                System.out.println(new String(packedEntry));
                jedis.rpop("pasteHistoryCache".getBytes());
                jedis.lpush("pasteHistoryCache".getBytes(), packedEntry);
            }

            return tokenId;
        } catch (JedisConnectionException je) {
            if (null != jedis) {
View Full Code Here

            // The cache hasn't been filled yet, so fills it
            if(startIndex == 0) {
                List<byte[]> packedHistory = getHistoryPacked(historyList);
                for(int i=packedHistory.size() - 1; i>=0; i--) {
                    byte[] pack = packedHistory.get(i);
                    jedis.lpush("pasteHistoryCache".getBytes(), pack);
                }
            }
            return historyList;
        } catch (JedisConnectionException je) {
            if (null != jedis) {
View Full Code Here

    }
   
    @Test
    public void testIsRegularQueue_Success() {
        final Jedis jedis = createJedis(CONFIG);
        jedis.lpush(TEST_KEY, "bar");
        Assert.assertTrue(JedisUtils.isRegularQueue(jedis, TEST_KEY));
    }

    @Test
    public void testIsRegularQueue_Failure() {
View Full Code Here

  }

  private void saveMessage(String msg) {
    Jedis jedis = redisPool.getResource();
    try {
      jedis.lpush(BBBMESSAGES, msg);
    } finally {
      redisPool.returnResource(jedis);
   
  }
 
View Full Code Here

        }

        Jedis jedisClient = null;
        try {
            jedisClient = jedisPool.getResource();
            jedisClient.lpush(redisKey,message.toJson(""));
            return true;
        } catch (Exception e) {
            errorReporter.reportError(e.getMessage(), new IOException("Cannot send REDIS data with key URI " + redisKey, e));
            return false;
        finally {
View Full Code Here

        Jedis jedis = null;
        try {
            jedis = this.jedisPool.getResource();

            long begin = System.currentTimeMillis();
            jedis.lpush(SafeEncoder.encode(key), jsonSerialize(value));
            long end = System.currentTimeMillis();
            LOG.info("lpush key:" + key + " spends: " + (end - begin)
                    + " millionseconds.");
        } catch (Exception e) {
            LOG.error(e.getMessage(), 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.