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

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

Introduction

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

Prototype

@Nullable
Long zInterStore(byte[] destKey, byte[]... sets);

Source Link

Document

Intersect sorted sets and store result in destination key .

Usage

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

public Long intersectAndStore(K key, Collection<K> otherKeys, K destKey) {
    final byte[][] rawKeys = rawKeys(key, otherKeys);
    final byte[] rawDestKey = rawKey(destKey);
    return execute(new RedisCallback<Long>() {

        public Long doInRedis(RedisConnection connection) {
            connection.select(dbIndex);/*w w w  . j a va2 s . c o m*/
            return connection.zInterStore(rawDestKey, rawKeys);
        }
    }, true);
}

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

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

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

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