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

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

Introduction

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

Prototype

@Nullable
byte[] sPop(byte[] key);

Source Link

Document

Remove and return a random member from set at key .

Usage

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

public V pop(K key) {
    return execute(new ValueDeserializingRedisCallback(key) {

        protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
            connection.select(dbIndex);//from   w  w  w  .j  av  a2s  .  c  om
            return connection.sPop(rawKey);
        }
    }, true);
}

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

/**
 * Remove and return a random member from set at {@code key}.
 * <p>/*from  w ww .  j av a 2s.  c om*/
 * See http://redis.io/commands/spop
 * 
 * @param key key
 * @return byte[]
 */
public static byte[] sPop(byte[] key) {
    return redisTemplate.execute(new RedisCallback<byte[]>() {
        @Override
        public byte[] doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.sPop(key);
        }
    });
}

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

/**
 * Remove and return a random member from set at {@code key}.
 * <p>/*from  w  w  w  . ja v  a2  s  .c  o  m*/
 * See http://redis.io/commands/spop
 * 
 * @param key key
 * @return byte[]
 */
public byte[] sPop(byte[] key) {
    return redisTemplate.execute(new RedisCallback<byte[]>() {
        @Override
        public byte[] doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.sPop(key);
        }
    });
}