Example usage for org.springframework.data.redis.connection RedisConnection zScore

List of usage examples for org.springframework.data.redis.connection RedisConnection zScore

Introduction

In this page you can find the example usage for org.springframework.data.redis.connection RedisConnection zScore.

Prototype

@Nullable
Double zScore(byte[] key, byte[] value);

Source Link

Document

Get the score of element with value from sorted set with key key .

Usage

From source file:com.mauersu.util.redis.DefaultZSetOperations.java

public Double score(K key, Object o) {
    final byte[] rawKey = rawKey(key);
    final byte[] rawValue = rawValue(o);

    return execute(new RedisCallback<Double>() {

        public Double doInRedis(RedisConnection connection) {
            connection.select(dbIndex);/*from  w  ww  .  j av a  2s .c  om*/
            return connection.zScore(rawKey, rawValue);
        }
    }, true);
}

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 ww.jav  a2s.  c o  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>//from  w  w w.  j av a2  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);
        }
    });
}