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

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

Introduction

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

Prototype

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

Source Link

Document

Diff all sets for given keys and store result in destKey .

Usage

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

public Long differenceAndStore(final K key, final 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 2s  .  c o  m
            return connection.sDiffStore(rawDestKey, rawKeys);
        }
    }, true);
}

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

/**
 * Diff all sets for given {@code keys} and store result in {@code destKey}
 * <p>//from  w  w  w.  j a  va2 s  .c  om
 * See http://redis.io/commands/sdiffstore
 * 
 * @param destKey destKey
 * @param keys keys
 * @return Long
 */
public static Long sDiffStore(byte[] destKey, byte[]... keys) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.sDiffStore(destKey, keys);
        }
    });
}

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

/**
 * Diff all sets for given {@code keys} and store result in {@code destKey}
 * <p>/*  ww w . java  2s .  co m*/
 * See http://redis.io/commands/sdiffstore
 * 
 * @param destKey destKey
 * @param keys keys
 * @return Long
 */
public Long sDiffStore(byte[] destKey, byte[]... keys) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.sDiffStore(destKey, keys);
        }
    });
}