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

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

Introduction

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

Prototype

@Nullable
Long sUnionStore(byte[] destKey, byte[]... keys);

Source Link

Document

Union all sets at given keys and store result in destKey .

Usage

From source file:com.mauersu.util.redis.DefaultSetOperations.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);/* w w w.j a va2 s  .co m*/
            return connection.sUnionStore(rawDestKey, rawKeys);
        }
    }, true);
}

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

/**
 * Union all sets at given {@code keys} and store result in {@code destKey}.
 * <p>//  w  w  w  .ja  v  a 2s .  co  m
 * See http://redis.io/commands/sunionstore
 * 
 * @param destKey destKey
 * @param keys keys
 * @return Long
 */
public static Long sUnionStore(byte[] destKey, byte[]... keys) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.sUnionStore(destKey, keys);
        }
    });
}

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

/**
 * Union all sets at given {@code keys} and store result in {@code destKey}.
 * <p>/*www  . ja  v a  2s.  com*/
 * See http://redis.io/commands/sunionstore
 * 
 * @param destKey destKey
 * @param keys keys
 * @return Long
 */
public Long sUnionStore(byte[] destKey, byte[]... keys) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.sUnionStore(destKey, keys);
        }
    });
}