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

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

Introduction

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

Prototype

@Nullable
Long sRem(byte[] key, byte[]... values);

Source Link

Document

Remove given values from set at key and return the number of removed elements.

Usage

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

public Long remove(K key, Object... values) {
    final byte[] rawKey = rawKey(key);
    final byte[][] rawValues = rawValues(values);
    return execute(new RedisCallback<Long>() {

        public Long doInRedis(RedisConnection connection) {
            connection.select(dbIndex);/*from   w  ww. jav  a 2  s. c  om*/
            return connection.sRem(rawKey, rawValues);
        }
    }, true);
}

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

/**
 * Remove given {@code values} from set at {@code key} and return the number of removed elements.
 * <p>//  ww w  .  j  a va2 s. com
 * See http://redis.io/commands/srem
 * 
 * @param key key
 * @param values values
 * @return Long
 */
public static Long sRem(byte[] key, byte[]... values) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.sRem(key, values);
        }
    });
}

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

/**
 * Remove given {@code values} from set at {@code key} and return the number of removed elements.
 * <p>// w  w  w  .  j  av a 2  s  .c om
 * See http://redis.io/commands/srem
 * 
 * @param key key
 * @param values values
 * @return Long
 */
public Long sRem(byte[] key, byte[]... values) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.sRem(key, values);
        }
    });
}