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

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

Introduction

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

Prototype

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

Source Link

Document

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

Usage

From source file:com.mauersu.util.redis.DefaultSetOperations.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);/*from w  w w .j a  va  2s.c o m*/
            connection.sInterStore(rawDestKey, rawKeys);
            return null;
        }
    }, true);
}

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

/**
 * Intersect all given sets at {@code keys} and store result in {@code destKey}.
 * <p>/*w w w.j  a  v  a2 s .  com*/
 * See http://redis.io/commands/sinterstore
 * 
 * @param destKey destKey
 * @param keys keys
 * @return Long
 */
public static Long sInterStore(byte[] destKey, byte[]... keys) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.sInterStore(destKey, keys);
        }
    });
}

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

/**
 * Intersect all given sets at {@code keys} and store result in {@code destKey}.
 * <p>/* w ww. j  av  a2 s .  c o  m*/
 * See http://redis.io/commands/sinterstore
 * 
 * @param destKey destKey
 * @param keys keys
 * @return Long
 */
public Long sInterStore(byte[] destKey, byte[]... keys) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.sInterStore(destKey, keys);
        }
    });
}