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

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

Introduction

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

Prototype

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

Source Link

Document

Union sorted sets and store result in destination key .

Usage

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

public Long unionAndStore(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);//from   w  w w .  j a v a  2 s  . c om
            return connection.zUnionStore(rawDestKey, rawKeys);
        }
    }, true);
}

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

/**
 * Union sorted {@code sets} and store result in destination {@code key}.
 * <p>//from  w w w  .ja v  a2  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>/*w w w . j  a va 2s . co  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);
        }
    });
}