List of usage examples for org.springframework.data.redis.connection RedisConnection bRPop
@Nullable List<byte[]> bRPop(int timeout, byte[]... keys);
From source file:com.mauersu.util.redis.DefaultListOperations.java
public V rightPop(K key, long timeout, TimeUnit unit) { final int tm = (int) TimeoutUtils.toSeconds(timeout, unit); return execute(new ValueDeserializingRedisCallback(key) { protected byte[] inRedis(byte[] rawKey, RedisConnection connection) { connection.select(dbIndex);/*from w w w . ja va 2s.com*/ List<byte[]> bRPop = connection.bRPop(tm, rawKey); return (CollectionUtils.isEmpty(bRPop) ? null : bRPop.get(1)); } }, true); }
From source file:com.zxy.commons.cache.RedisUtils.java
/** * Removes and returns last element from lists stored at {@code keys} (see: {@link #rPop(byte[])}). <br> * <b>Blocks connection</b> until element available or {@code timeout} reached. * <p>/*from ww w .j a va2 s .c om*/ * See http://redis.io/commands/brpop * * @param timeout timeout * @param keys keys * @return List<byte[]> */ public static List<byte[]> bRPop(int timeout, byte[]... keys) { return redisTemplate.execute(new RedisCallback<List<byte[]>>() { @Override public List<byte[]> doInRedis(RedisConnection redis) throws DataAccessException { return redis.bRPop(timeout, keys); } }); }
From source file:com.zxy.commons.cache.RedisHelper.java
/** * Removes and returns last element from lists stored at {@code keys} (see: {@link #rPop(byte[])}). <br> * <b>Blocks connection</b> until element available or {@code timeout} reached. * <p>//from www .j a v a 2s . com * See http://redis.io/commands/brpop * * @param timeout timeout * @param keys keys * @return List<byte[]> */ public List<byte[]> bRPop(int timeout, byte[]... keys) { return redisTemplate.execute(new RedisCallback<List<byte[]>>() { @Override public List<byte[]> doInRedis(RedisConnection redis) throws DataAccessException { return redis.bRPop(timeout, keys); } }); }