List of usage examples for org.springframework.data.redis.core RedisCallback RedisCallback
RedisCallback
From source file:com.zxy.commons.cache.RedisHelper.java
/** * Set the {@code value} list element at {@code index}. * <p>// w w w . j av a 2 s .com * See http://redis.io/commands/lset * * @param key key * @param index index * @param value value */ public void lSet(byte[] key, long index, byte[] value) { redisTemplate.execute(new RedisCallback<Void>() { @Override public Void doInRedis(RedisConnection redis) throws DataAccessException { redis.lSet(key, index, value); return null; } }); }
From source file:com.zxy.commons.cache.RedisUtils.java
/** * Removes and returns first element in list stored at {@code key}. * <p>// ww w . j a v a 2s . c o m * See http://redis.io/commands/lpop * * @param key key * @return byte[] */ public static byte[] lPop(byte[] key) { return redisTemplate.execute(new RedisCallback<byte[]>() { @Override public byte[] doInRedis(RedisConnection redis) throws DataAccessException { return redis.lPop(key); } }); }
From source file:com.zxy.commons.cache.RedisHelper.java
/** * Removes the first {@code count} occurrences of {@code value} from the list stored at {@code key}. * <p>/*w ww. j av a2 s . com*/ * See http://redis.io/commands/lrem * * @param key key * @param count count * @param value value * @return Long */ public Long lRem(byte[] key, long count, byte[] value) { return redisTemplate.execute(new RedisCallback<Long>() { @Override public Long doInRedis(RedisConnection redis) throws DataAccessException { return redis.lRem(key, count, value); } }); }
From source file:com.zxy.commons.cache.RedisUtils.java
/** * Removes and returns last element in list stored at {@code key}. * <p>// w ww . ja v a2s.c o m * See http://redis.io/commands/rpop * * @param key key * @return byte[] */ public static byte[] rPop(byte[] key) { return redisTemplate.execute(new RedisCallback<byte[]>() { @Override public byte[] doInRedis(RedisConnection redis) throws DataAccessException { return redis.rPop(key); } }); }
From source file:com.zxy.commons.cache.RedisHelper.java
/** * Removes and returns first element in list stored at {@code key}. * <p>/*from www.j a v a2s . c o m*/ * See http://redis.io/commands/lpop * * @param key key * @return byte[] */ public byte[] lPop(byte[] key) { return redisTemplate.execute(new RedisCallback<byte[]>() { @Override public byte[] doInRedis(RedisConnection redis) throws DataAccessException { return redis.lPop(key); } }); }
From source file:com.zxy.commons.cache.RedisHelper.java
/** * Removes and returns last element in list stored at {@code key}. * <p>/*from ww w . jav a2 s . c om*/ * See http://redis.io/commands/rpop * * @param key key * @return byte[] */ public byte[] rPop(byte[] key) { return redisTemplate.execute(new RedisCallback<byte[]>() { @Override public byte[] doInRedis(RedisConnection redis) throws DataAccessException { return redis.rPop(key); } }); }
From source file:com.zxy.commons.cache.RedisUtils.java
/** * Removes and returns first element from lists stored at {@code keys} (see: {@link #lPop(byte[])}). <br> * <b>Blocks connection</b> until element available or {@code timeout} reached. * <p>/* w w w .j av a 2 s . c o m*/ * See http://redis.io/commands/blpop * * @param timeout timeout * @param keys keys * @return List<byte[]> */ public static List<byte[]> bLPop(int timeout, byte[]... keys) { return redisTemplate.execute(new RedisCallback<List<byte[]>>() { @Override public List<byte[]> doInRedis(RedisConnection redis) throws DataAccessException { return redis.bLPop(timeout, keys); } }); }
From source file:com.zxy.commons.cache.RedisHelper.java
/** * Removes and returns first element from lists stored at {@code keys} (see: {@link #lPop(byte[])}). <br> * <b>Blocks connection</b> until element available or {@code timeout} reached. * <p>//from www . j a v a 2 s .c o m * See http://redis.io/commands/blpop * * @param timeout timeout * @param keys keys * @return List<byte[]> */ public List<byte[]> bLPop(int timeout, byte[]... keys) { return redisTemplate.execute(new RedisCallback<List<byte[]>>() { @Override public List<byte[]> doInRedis(RedisConnection redis) throws DataAccessException { return redis.bLPop(timeout, keys); } }); }
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 w w w.j a va 2 s . c o m*/ * 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.RedisUtils.java
/** * Remove the last element from list at {@code srcKey}, append it to {@code dstKey} and return its value. * <p>/*from www . ja v a 2s . c o m*/ * See http://redis.io/commands/rpoplpush * * @param srcKey srcKey * @param dstKey dstKey * @return byte[] */ public static byte[] rPopLPush(byte[] srcKey, byte[] dstKey) { return redisTemplate.execute(new RedisCallback<byte[]>() { @Override public byte[] doInRedis(RedisConnection redis) throws DataAccessException { return redis.rPopLPush(srcKey, dstKey); } }); }