public ValueOperationsopsForValue() {
if (valueOps == null) {
valueOps = new DefaultValueOperations(this);
}
return valueOps;
}
ValueOperations源码如下:
public interface ValueOperations {
/**
* Set {@code value} for {@code key}.
*
* @param key must not be {@literal null}.
* @param value
* @seeRedis Documentation: SET
*/
void set(K key, V value);
/**
* Set the {@code value} and expiration {@code timeout} for {@code key}.
*
* @param key must not be {@literal null}.
* @param value
* @param timeout
* @param unit must not be {@literal null}.
* @seeRedis Documentation: SETEX
*/
void set(K key, V value, long timeout, TimeUnit unit);
/**
* Set {@code key} to hold the string {@code value} if {@code key} is absent.
*
* @param key must not be {@literal null}.
* @param value
* @seeRedis Documentation: SETNX
*/
Boolean setIfAbsent(K key, V value);
/**
* Set multiple keys to multiple values using key-value pairs provided in {@code tuple}.
*
* @param map must not be {@literal null}.
* @seeRedis Documentation: MSET
*/
void multiSet(Map extends K, ? extends V> map);
/**
* Set multiple keys to multiple values using key-value pairs provided in {@code tuple} only if the provided key does
* not exist.
*
* @param map must not be {@literal null}.
* @seeRedis Documentation: MSET
*/
Boolean multiSetIfAbsent(Map extends K, ? extends V> map);
/**
* Get the value of {@code key}.
*
* @param key must not be {@literal null}.
* @seeRedis Documentation: GET
*/
V get(Object key);
/**
* Set {@code value} of {@code key} and return its old value.
*
* @param key must not be {@literal null}.
* @seeRedis Documentation: GETSET
*/
V getAndSet(K key, V value);
/**
* Get multiple {@code keys}. Values are returned in the order of the requested keys.
*
* @param keys must not be {@literal null}.
* @seeRedis Documentation: MGET
*/
List multiGet(Collection keys);
/**
* Increment an integer value stored as string value under {@code key} by {@code delta}.
*
* @param key must not be {@literal null}.
* @param delta
* @seeRedis Documentation: INCR
*/
Long increment(K key, long delta);
/**
* Increment a floating point number value stored as string value under {@code key} by {@code delta}.
*
* @param key must not be {@literal null}.
* @param delta
* @seeRedis Documentation: INCRBYFLOAT
*/
Double increment(K key, double delta);
/**
* Append a {@code value} to {@code key}.
*
* @param key must not be {@literal null}.
* @param value
* @seeRedis Documentation: APPEND
*/
Integer append(K key, String value);
/**
* Get a substring of value of {@code key} between {@code begin} and {@code end}.
*
* @param key must not be {@literal null}.
* @param start
* @param end
* @seeRedis Documentation: GETRANGE
*/
String get(K key, long start, long end);
/**
* Overwrite parts of {@code key} starting at the specified {@code offset} with given {@code value}.
*
* @param key must not be {@literal null}.
* @param value
* @param offset
* @seeRedis Documentation: SETRANGE
*/
void set(K key, V value, long offset);
/**
* Get the length of the value stored at {@code key}.
*
* @param key must not be {@literal null}.
* @seeRedis Documentation: STRLEN
*/
Long size(K key);
/**
* Sets the bit at {@code offset} in value stored at {@code key}.
*
* @param key must not be {@literal null}.
* @param offset
* @param value
* @since 1.5
* @seeRedis Documentation: SETBIT
*/
Boolean setBit(K key, long offset, boolean value);
/**
* Get the bit value at {@code offset} of value at {@code key}.
*
* @param key must not be {@literal null}.
* @param offset
* @since 1.5
* @seeRedis Documentation: GETBIT
*/
Boolean getBit(K key, long offset);
RedisOperations getOperations();
}
/**
* Interface for the commands supported by Redis.
*
* @author Costin Leau
* @author Christoph Strobl
*/publicinterfaceRedisCommandsextendsRedisKeyCommands, RedisStringCommands, RedisListCommands, RedisSetCommands,
RedisZSetCommands, RedisHashCommands, RedisTxCommands, RedisPubSubCommands, RedisConnectionCommands,
RedisServerCommands, RedisScriptingCommands, RedisGeoCommands, HyperLogLogCommands {/**
* 'Native' or 'raw' execution of the given command along-side the given arguments. The command is executed as is,
* with as little 'interpretation' as possible - it is up to the caller to take care of any processing of arguments or
* the result.
*
* @param command Command to execute
* @param args Possible command arguments (may be null)
* @return execution result.
*/
Object execute(String command, byte[]... args);
}