Example usage for org.springframework.data.redis.core RedisCallback RedisCallback

List of usage examples for org.springframework.data.redis.core RedisCallback RedisCallback

Introduction

In this page you can find the example usage for org.springframework.data.redis.core RedisCallback RedisCallback.

Prototype

RedisCallback

Source Link

Usage

From source file:com.zxy.commons.cache.RedisUtils.java

/**
 * Get all the elements in {@link Range} from the sorted set at {@literal key} in lexicographical ordering. Result is
 * limited via {@link Limit}.//  ww w. j a v  a 2  s .co  m
 * 
 * @param key must not be {@literal null}.
 * @param range must not be {@literal null}.
 * @param limit can be {@literal null}.
 * @return Set<byte[]>
 * @since 1.6
 */
public static Set<byte[]> zRangeByLex(byte[] key, Range range, Limit limit) {
    return redisTemplate.execute(new RedisCallback<Set<byte[]>>() {
        @Override
        public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRangeByLex(key, range, limit);
        }
    });
}

From source file:com.zxy.commons.cache.RedisHelper.java

/**
 * Get all the elements in {@link Range} from the sorted set at {@literal key} in lexicographical ordering. Result is
 * limited via {@link Limit}.//from  w w  w . ja  va 2  s. c o m
 * 
 * @param key must not be {@literal null}.
 * @param range must not be {@literal null}.
 * @param limit can be {@literal null}.
 * @return Set<byte[]>
 * @since 1.6
 */
public Set<byte[]> zRangeByLex(byte[] key, Range range, Limit limit) {
    return redisTemplate.execute(new RedisCallback<Set<byte[]>>() {
        @Override
        public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRangeByLex(key, range, limit);
        }
    });
}

From source file:com.zxy.commons.cache.RedisUtils.java

/**
 * Set the {@code value} of a hash {@code field}.
 * /*from   ww w  .  ja v a 2s  . co  m*/
 * @see http://redis.io/commands/hset
 * @param key key
 * @param field field
 * @param value value
 * @return Boolean
 */
public static Boolean hSet(byte[] key, byte[] field, byte[] value) {
    return redisTemplate.execute(new RedisCallback<Boolean>() {
        @Override
        public Boolean doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hSet(key, field, value);
        }
    });
}

From source file:com.zxy.commons.cache.RedisHelper.java

/**
 * Set the {@code value} of a hash {@code field}.
 * /*w  ww.  ja  va2 s .  co m*/
 * @see http://redis.io/commands/hset
 * @param key key
 * @param field field
 * @param value value
 * @return Boolean
 */
public Boolean hSet(byte[] key, byte[] field, byte[] value) {
    return redisTemplate.execute(new RedisCallback<Boolean>() {
        @Override
        public Boolean doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hSet(key, field, value);
        }
    });
}

From source file:com.zxy.commons.cache.RedisUtils.java

/**
 * Set the {@code value} of a hash {@code field} only if {@code field} does not exist.
 * //  w  ww  . j ava  2s. co m
 * @see http://redis.io/commands/hsetnx
 * @param key key
 * @param field field
 * @param value value
 * @return Boolean
 */
public static Boolean hSetNX(byte[] key, byte[] field, byte[] value) {
    return redisTemplate.execute(new RedisCallback<Boolean>() {
        @Override
        public Boolean doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hSetNX(key, field, value);
        }
    });
}

From source file:com.zxy.commons.cache.RedisHelper.java

/**
 * Set the {@code value} of a hash {@code field} only if {@code field} does not exist.
 * //from  www.  j  ava 2  s  . c o  m
 * @see http://redis.io/commands/hsetnx
 * @param key key
 * @param field field
 * @param value value
 * @return Boolean
 */
public Boolean hSetNX(byte[] key, byte[] field, byte[] value) {
    return redisTemplate.execute(new RedisCallback<Boolean>() {
        @Override
        public Boolean doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hSetNX(key, field, value);
        }
    });
}

From source file:com.zxy.commons.cache.RedisUtils.java

/**
 * Get value for given {@code field} from hash at {@code key}.
 * /*from  www  .  ja  v  a 2s  .  co m*/
 * @see http://redis.io/commands/hget
 * @param key key
 * @param field field
 * @return byte[
 */
public static byte[] hGet(byte[] key, byte[] field) {
    return redisTemplate.execute(new RedisCallback<byte[]>() {
        @Override
        public byte[] doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hGet(key, field);
        }
    });
}

From source file:com.zxy.commons.cache.RedisHelper.java

/**
 * Get value for given {@code field} from hash at {@code key}.
 * //  ww w.  ja va  2s. c o m
 * @see http://redis.io/commands/hget
 * @param key key
 * @param field field
 * @return byte[
 */
public byte[] hGet(byte[] key, byte[] field) {
    return redisTemplate.execute(new RedisCallback<byte[]>() {
        @Override
        public byte[] doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hGet(key, field);
        }
    });
}

From source file:com.zxy.commons.cache.RedisUtils.java

/**
 * Get values for given {@code fields} from hash at {@code key}.
 * //from   w w w  .ja  v a 2 s  . com
 * @see http://redis.io/commands/hmget
 * @param key key
 * @param fields fields
 * @return List<byte[]>
 */
public static List<byte[]> hMGet(byte[] key, byte[]... fields) {
    return redisTemplate.execute(new RedisCallback<List<byte[]>>() {
        @Override
        public List<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hMGet(key, fields);
        }
    });
}

From source file:com.zxy.commons.cache.RedisHelper.java

/**
 * Get values for given {@code fields} from hash at {@code key}.
 * //from  w  w w.j  a  v a 2 s  . c o  m
 * @see http://redis.io/commands/hmget
 * @param key key
 * @param fields fields
 * @return List<byte[]>
 */
public List<byte[]> hMGet(byte[] key, byte[]... fields) {
    return redisTemplate.execute(new RedisCallback<List<byte[]>>() {
        @Override
        public List<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hMGet(key, fields);
        }
    });
}