com.lordofthejars.nosqlunit.redis.embedded
public class StringDatatypeOperations extends ExpirationDatatypeOperations implements RedisDatatypeOperations
ExpirationDatatypeOperations.TtlState| Modifier and Type | Field and Description |
|---|---|
protected Map<ByteBuffer,ByteBuffer> |
simpleTypes |
protected static String |
STRING |
expirationsInMillis, NO_EXPIRATION| Constructor and Description |
|---|
StringDatatypeOperations() |
| Modifier and Type | Method and Description |
|---|---|
Long |
append(byte[] key,
byte[] value)
If the key already exists and is a string, this command appends the
provided value at the end of the string.
|
Long |
bitcount(byte[] key) |
Long |
bitcount(byte[] key,
long startOffset,
long endOffset) |
Long |
decr(byte[] key)
Decrement the number stored at key by one.
|
Long |
decrBy(byte[] key,
long integer)
IDECRBY work just like
INCR but instead to
decrement by 1 the decrement is integer. |
Long |
del(byte[]... keys) |
boolean |
exists(byte[] key) |
void |
flushAllKeys() |
byte[] |
get(byte[] key) |
Boolean |
getbit(byte[] key,
long offset)
Returns the bit value at offset in the string value stored at key
|
long |
getNumberOfKeys() |
byte[] |
getrange(byte[] key,
long startOffset,
long endOffset) |
byte[] |
getSet(byte[] key,
byte[] value) |
Long |
incr(byte[] key)
Increment the number stored at key by one.
|
Long |
incrBy(byte[] key,
long integer)
INCRBY work just like
INCR but instead to increment
by 1 the increment is integer. |
List<byte[]> |
keys() |
List<byte[]> |
mget(byte[]... keys) |
String |
mset(byte[]... keysvalues) |
Long |
msetnx(byte[]... keysvalues) |
String |
rename(byte[] oldKey,
byte[] newKey) |
boolean |
renameKey(byte[] key,
byte[] newKey) |
String |
set(byte[] key,
byte[] value) |
Boolean |
setbit(byte[] key,
long offset,
byte[] value)
Sets or clears the bit at offset in the string value stored at key
|
String |
setex(byte[] key,
int seconds,
byte[] value) |
Long |
setnx(byte[] key,
byte[] value) |
Long |
setrange(byte[] key,
long offset,
byte[] value) |
List<byte[]> |
sort(byte[] key) |
long |
strlen(byte[] key) |
byte[] |
substr(byte[] key,
int start,
int end)
Return a subset of the string from offset start to offset end (both
offsets are inclusive).
|
String |
type() |
addExpirationAt, addExpirationTime, remainingTime, removeExpiration, renameTtlKey, timedoutStateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddExpirationAt, addExpirationTime, remainingTime, removeExpiration, timedoutStateprotected static final String STRING
protected Map<ByteBuffer,ByteBuffer> simpleTypes
public Long append(byte[] key, byte[] value)
Time complexity: O(1). The amortized time complexity is O(1) assuming the appended value is small and the already present value is of any size, since the dynamic string library used by Redis will double the free space available on every reallocation.
key - value - public Long decr(byte[] key)
INCR commands are limited to 64 bit signed integers.
Note: this is actually a string operation, that is, in Redis there are not "integer" types. Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, and then converted back as a string.
Time complexity: O(1)
key - incr(byte[]),
incrBy(byte[], long),
decrBy(byte[], long)public Long decrBy(byte[] key, long integer)
INCR but instead to
decrement by 1 the decrement is integer.
INCR commands are limited to 64 bit signed integers.
Note: this is actually a string operation, that is, in Redis there are not "integer" types. Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, and then converted back as a string.
key - integer - incr(byte[]),
decr(byte[]),
incrBy(byte[], long)public Long incrBy(byte[] key, long integer)
INCR but instead to increment
by 1 the increment is integer.
INCR commands are limited to 64 bit signed integers.
Note: this is actually a string operation, that is, in Redis there are not "integer" types. Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, and then converted back as a string.
key - integer - incr(byte[]),
decr(byte[]),
decrBy(byte[], long)public Long incr(byte[] key)
INCR commands are limited to 64 bit signed integers.
Note: this is actually a string operation, that is, in Redis there are not "integer" types. Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, and then converted back as a string.
key - incrBy(byte[], long),
decr(byte[]),
decrBy(byte[], long)public Boolean getbit(byte[] key, long offset)
key - offset - public Long bitcount(byte[] key)
public Long bitcount(byte[] key, long startOffset, long endOffset)
public Boolean setbit(byte[] key, long offset, byte[] value)
key - offset - value - public Long setrange(byte[] key, long offset, byte[] value)
public byte[] getrange(byte[] key,
long startOffset,
long endOffset)
public String mset(byte[]... keysvalues)
public Long msetnx(byte[]... keysvalues)
public long strlen(byte[] key)
public String rename(byte[] oldKey, byte[] newKey)
public List<byte[]> mget(byte[]... keys)
public byte[] get(byte[] key)
public byte[] getSet(byte[] key,
byte[] value)
public String set(byte[] key, byte[] value)
public Long setnx(byte[] key, byte[] value)
public String setex(byte[] key, int seconds, byte[] value)
public byte[] substr(byte[] key,
int start,
int end)
The function handles out of range requests without raising an error, but just limiting the resulting range to the actual length of the string.
key - start - end - public long getNumberOfKeys()
getNumberOfKeys in interface RedisDatatypeOperationspublic void flushAllKeys()
flushAllKeys in interface RedisDatatypeOperationspublic Long del(byte[]... keys)
del in interface RedisDatatypeOperationspublic boolean exists(byte[] key)
exists in interface RedisDatatypeOperationspublic boolean renameKey(byte[] key,
byte[] newKey)
renameKey in interface RedisDatatypeOperationspublic List<byte[]> keys()
keys in interface RedisDatatypeOperationspublic String type()
type in interface RedisDatatypeOperationspublic List<byte[]> sort(byte[] key)
sort in interface RedisDatatypeOperationsCopyright © 2014. All Rights Reserved.