List of usage examples for org.springframework.data.redis.core RedisCallback RedisCallback
RedisCallback
From source file:com.zxy.commons.cache.RedisHelper.java
/** * Get the time to live for {@code key} in seconds. * <p>/*from ww w . j a v a 2 s .c o m*/ * See http://redis.io/commands/ttl * * @param key key * @return Long */ public Long ttl(byte[] key) { return redisTemplate.execute(new RedisCallback<Long>() { @Override public Long doInRedis(RedisConnection redis) throws DataAccessException { return redis.ttl(key); } }); }
From source file:com.zxy.commons.cache.RedisUtils.java
/** * Sort the elements for {@code key}./*from w ww . j a v a 2 s .c o m*/ * <p> * See http://redis.io/commands/sort * * @param key key * @param params params * @return List<byte[]> */ public static List<byte[]> sort(byte[] key, SortParameters params) { return redisTemplate.execute(new RedisCallback<List<byte[]>>() { @Override public List<byte[]> doInRedis(RedisConnection redis) throws DataAccessException { return redis.sort(key, params); } }); }
From source file:com.zxy.commons.cache.RedisHelper.java
/** * Get the time to live for {@code key} in milliseconds. * <p>/*ww w . j a v a2 s .c om*/ * See http://redis.io/commands/pttl * * @param key key * @return Long */ public Long pTtl(byte[] key) { return redisTemplate.execute(new RedisCallback<Long>() { @Override public Long doInRedis(RedisConnection redis) throws DataAccessException { return redis.pTtl(key); } }); }
From source file:com.zxy.commons.cache.RedisUtils.java
/** * Sort the elements for {@code key} and store result in {@code storeKey}. * <p>//from w w w . jav a 2s . c om * See http://redis.io/commands/sort * * @param key key * @param params params * @param storeKey storeKey * @return Long */ public static Long sort(byte[] key, SortParameters params, byte[] storeKey) { return redisTemplate.execute(new RedisCallback<Long>() { @Override public Long doInRedis(RedisConnection redis) throws DataAccessException { return redis.sort(key, params, storeKey); } }); }
From source file:com.zxy.commons.cache.RedisHelper.java
/** * Sort the elements for {@code key}.//from ww w . j av a 2s .co m * <p> * See http://redis.io/commands/sort * * @param key key * @param params params * @return List<byte[]> */ public List<byte[]> sort(byte[] key, SortParameters params) { return redisTemplate.execute(new RedisCallback<List<byte[]>>() { @Override public List<byte[]> doInRedis(RedisConnection redis) throws DataAccessException { return redis.sort(key, params); } }); }
From source file:com.zxy.commons.cache.RedisUtils.java
/** * Retrieve serialized version of the value stored at {@code key}. * <p>//from w ww . j a v a2 s .c o m * See http://redis.io/commands/dump * * @param key key * @return byte[] */ public static byte[] dump(byte[] key) { return redisTemplate.execute(new RedisCallback<byte[]>() { @Override public byte[] doInRedis(RedisConnection redis) throws DataAccessException { return redis.dump(key); } }); }
From source file:com.zxy.commons.cache.RedisHelper.java
/** * Sort the elements for {@code key} and store result in {@code storeKey}. * <p>//from w w w . j a v a 2s .c o m * See http://redis.io/commands/sort * * @param key key * @param params params * @param storeKey storeKey * @return Long */ public Long sort(byte[] key, SortParameters params, byte[] storeKey) { return redisTemplate.execute(new RedisCallback<Long>() { @Override public Long doInRedis(RedisConnection redis) throws DataAccessException { return redis.sort(key, params, storeKey); } }); }
From source file:com.zxy.commons.cache.RedisUtils.java
/** * Create {@code key} using the {@code serializedValue}, previously obtained using {@link #dump(byte[])}. * <p>/*from ww w .jav a2 s . c o m*/ * See http://redis.io/commands/restore * * @param key key * @param ttlInMillis ttlInMillis * @param serializedValue serializedValue */ public static void restore(byte[] key, long ttlInMillis, byte[] serializedValue) { redisTemplate.execute(new RedisCallback<Void>() { @Override public Void doInRedis(RedisConnection redis) throws DataAccessException { redis.restore(key, ttlInMillis, serializedValue); return null; } }); }
From source file:com.zxy.commons.cache.RedisHelper.java
/** * Retrieve serialized version of the value stored at {@code key}. * <p>/*ww w . jav a 2 s . c om*/ * See http://redis.io/commands/dump * * @param key key * @return byte[] */ public byte[] dump(byte[] key) { return redisTemplate.execute(new RedisCallback<byte[]>() { @Override public byte[] doInRedis(RedisConnection redis) throws DataAccessException { return redis.dump(key); } }); }
From source file:com.zxy.commons.cache.RedisUtils.java
/** * Append {@code values} to {@code key}. * <p>//w w w .ja v a2s .c om * See http://redis.io/commands/rpush * * @param key key * @param values values * @return Long */ public static Long rPush(byte[] key, byte[]... values) { return redisTemplate.execute(new RedisCallback<Long>() { @Override public Long doInRedis(RedisConnection redis) throws DataAccessException { return redis.rPush(key, values); } }); }