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 the score of element with {@code value} from sorted set with key {@code key}.
 * <p>//from w  w w  .  ja v a2  s.co  m
 * See http://redis.io/commands/zrem
 * 
 * @param key key
 * @param value value
 * @return Double
 */
public static Double zScore(byte[] key, byte[] value) {
    return redisTemplate.execute(new RedisCallback<Double>() {
        @Override
        public Double doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zScore(key, value);
        }
    });
}

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

/**
 * Get the score of element with {@code value} from sorted set with key {@code key}.
 * <p>/*  ww w.  j  a va  2 s  .  co  m*/
 * See http://redis.io/commands/zrem
 * 
 * @param key key
 * @param value value
 * @return Double
 */
public Double zScore(byte[] key, byte[] value) {
    return redisTemplate.execute(new RedisCallback<Double>() {
        @Override
        public Double doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zScore(key, value);
        }
    });
}

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

/**
 * Remove elements in range between {@code begin} and {@code end} from sorted set with {@code key}.
 * <p>/*  w  ww. j  a  v  a 2  s .  c o m*/
 * See http://redis.io/commands/zremrange
 * 
 * @param key key
 * @param begin begin
 * @param end end
 * @return Long
 */
public static Long zRemRange(byte[] key, long begin, long end) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRemRange(key, begin, end);
        }
    });
}

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

/**
 * Remove elements in range between {@code begin} and {@code end} from sorted set with {@code key}.
 * <p>// w  w  w  .j  a  v  a 2  s  . c  o  m
 * See http://redis.io/commands/zremrange
 * 
 * @param key key
 * @param begin begin
 * @param end end
 * @return Long
 */
public Long zRemRange(byte[] key, long begin, long end) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRemRange(key, begin, end);
        }
    });
}

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

/**
 * Remove elements with scores between {@code min} and {@code max} from sorted set with {@code key}.
 * <p>/*from   w w w .  j  a v  a 2s .c om*/
 * See http://redis.io/commands/zremrangebyscore
 * 
 * @param key key
 * @param min min
 * @param max max
 * @return Long
 */
public static Long zRemRangeByScore(byte[] key, double min, double max) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRemRangeByScore(key, min, max);
        }
    });
}

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

/**
 * Remove elements with scores between {@code min} and {@code max} from sorted set with {@code key}.
 * <p>// w  w  w.ja va2s . c  o  m
 * See http://redis.io/commands/zremrangebyscore
 * 
 * @param key key
 * @param min min
 * @param max max
 * @return Long
 */
public Long zRemRangeByScore(byte[] key, double min, double max) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRemRangeByScore(key, min, max);
        }
    });
}

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

/**
 * Remove elements with scores between {@code Range#min} and {@code Range#max} from sorted set with {@code key}.
 * /*from  www . j a va  2 s  .c  om*/
 * @param key key
 * @param range range
 * @return Long
 * @since 1.6
 */
public static Long zRemRangeByScore(byte[] key, Range range) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRemRangeByScore(key, range);
        }
    });
}

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

/**
 * Remove elements with scores between {@code Range#min} and {@code Range#max} from sorted set with {@code key}.
 * /*from  ww w.ja  v  a2s  . c  o m*/
 * @param key key
 * @param range range
 * @return Long
 * @since 1.6
 */
public Long zRemRangeByScore(byte[] key, Range range) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRemRangeByScore(key, range);
        }
    });
}

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

/**
 * Union sorted {@code sets} and store result in destination {@code key}.
 * <p>/*from  w  ww .  j  a  va2  s. c  om*/
 * See http://redis.io/commands/zunionstore
 * 
 * @param destKey destKey
 * @param sets sets
 * @return Long
 */
public static Long zUnionStore(byte[] destKey, byte[]... sets) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zUnionStore(destKey, sets);
        }
    });
}

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

/**
 * Union sorted {@code sets} and store result in destination {@code key}.
 * <p>//from   w ww. ja v  a  2  s  .  c o m
 * See http://redis.io/commands/zunionstore
 * 
 * @param destKey destKey
 * @param sets sets
 * @return Long
 */
public Long zUnionStore(byte[] destKey, byte[]... sets) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zUnionStore(destKey, sets);
        }
    });
}