List of usage examples for org.springframework.data.redis.connection RedisConnection getSet
@Nullable byte[] getSet(byte[] key, byte[] value);
From source file:com.mauersu.util.redis.DefaultValueOperations.java
public V getAndSet(K key, V newValue) { final byte[] rawValue = rawValue(newValue); return execute(new ValueDeserializingRedisCallback(key) { protected byte[] inRedis(byte[] rawKey, RedisConnection connection) { connection.select(dbIndex);// ww w. j a v a2 s. com return connection.getSet(rawKey, rawValue); } }, true); }
From source file:com.zxy.commons.cache.RedisUtils.java
/** * Set value of {@code key} and return its old value. * <p>// w w w .j av a2 s . c om * See http://redis.io/commands/getset * * @param key must not be {@literal null}. * @param value value * @return byte[] */ public static byte[] getSet(byte[] key, byte[] value) { return redisTemplate.execute(new RedisCallback<byte[]>() { @Override public byte[] doInRedis(RedisConnection redis) throws DataAccessException { return redis.getSet(key, value); } }); }
From source file:com.zxy.commons.cache.RedisHelper.java
/** * Set value of {@code key} and return its old value. * <p>/*from w w w . j a v a 2 s . co m*/ * See http://redis.io/commands/getset * * @param key must not be {@literal null}. * @param value value * @return byte[] */ public byte[] getSet(byte[] key, byte[] value) { return redisTemplate.execute(new RedisCallback<byte[]>() { @Override public byte[] doInRedis(RedisConnection redis) throws DataAccessException { return redis.getSet(key, value); } }); }