public interface RedisStringCommands
Modifier and Type | Interface and Description |
---|---|
static class |
RedisStringCommands.BitOperation |
static class |
RedisStringCommands.SetOption
SET command arguments for NX , XX . |
Modifier and Type | Method and Description |
---|---|
Long |
append(byte[] key,
byte[] value)
Append a
value to key . |
Long |
bitCount(byte[] key)
Count the number of set bits (population counting) in value stored at
key . |
Long |
bitCount(byte[] key,
long start,
long end)
Count the number of set bits (population counting) of value stored at
key between start and
end . |
List<Long> |
bitField(byte[] key,
BitFieldSubCommands subCommands)
Get / Manipulate specific integer fields of varying bit widths and arbitrary non (necessary) aligned offset stored
at a given
key . |
Long |
bitOp(RedisStringCommands.BitOperation op,
byte[] destination,
byte[]... keys)
Perform bitwise operations between strings.
|
default Long |
bitPos(byte[] key,
boolean bit)
Return the position of the first bit set to given
bit in a string. |
Long |
bitPos(byte[] key,
boolean bit,
org.springframework.data.domain.Range<Long> range)
Return the position of the first bit set to given
bit in a string. |
Long |
decr(byte[] key)
Decrement an integer value stored as string value of
key by 1. |
Long |
decrBy(byte[] key,
long value)
Decrement an integer value stored as string value of
key by value . |
byte[] |
get(byte[] key)
Get the value of
key . |
Boolean |
getBit(byte[] key,
long offset)
Get the bit value at
offset of value at key . |
byte[] |
getDel(byte[] key)
Return the value at
key and delete the key. |
byte[] |
getEx(byte[] key,
Expiration expiration)
Return the value at
key and expire the key by applying Expiration . |
byte[] |
getRange(byte[] key,
long start,
long end)
Get a substring of value of
key between start and end . |
byte[] |
getSet(byte[] key,
byte[] value)
Set
value of key and return its old value. |
Long |
incr(byte[] key)
Increment an integer value stored as string value of
key by 1. |
Double |
incrBy(byte[] key,
double value)
Increment a floating point number value of
key by delta . |
Long |
incrBy(byte[] key,
long value)
Increment an integer value stored of
key by delta . |
List<byte[]> |
mGet(byte[]... keys)
Get multiple
keys . |
Boolean |
mSet(Map<byte[],byte[]> tuple)
Set multiple keys to multiple values using key-value pairs provided in
tuple . |
Boolean |
mSetNX(Map<byte[],byte[]> tuple)
Set multiple keys to multiple values using key-value pairs provided in
tuple only if the provided key does
not exist. |
Boolean |
pSetEx(byte[] key,
long milliseconds,
byte[] value)
Set the
value and expiration in milliseconds for key . |
Boolean |
set(byte[] key,
byte[] value)
Set
value for key . |
Boolean |
set(byte[] key,
byte[] value,
Expiration expiration,
RedisStringCommands.SetOption option)
Set
value for key applying timeouts from expiration if set and inserting/updating values
depending on option . |
Boolean |
setBit(byte[] key,
long offset,
boolean value)
Sets the bit at
offset in value stored at key . |
Boolean |
setEx(byte[] key,
long seconds,
byte[] value)
Set the
value and expiration in seconds for key . |
Boolean |
setNX(byte[] key,
byte[] value)
Set
value for key , only if key does not exist. |
void |
setRange(byte[] key,
byte[] value,
long offset)
Overwrite parts of
key starting at the specified offset with given value . |
Long |
strLen(byte[] key)
Get the length of the value stored at
key . |
@Nullable byte[] get(byte[] key)
key
.key
- must not be null.@Nullable byte[] getDel(byte[] key)
key
and delete the key.key
- must not be null.@Nullable byte[] getEx(byte[] key, Expiration expiration)
key
and expire the key by applying Expiration
.
Use Expiration.seconds(long)
for EX
.
Use Expiration.milliseconds(long)
for PX
.
Use Expiration.unixTimestamp(long, TimeUnit)
for EXAT | PXAT
.
key
- must not be null.expiration
- must not be null.@Nullable byte[] getSet(byte[] key, byte[] value)
value
of key
and return its old value.key
- must not be null.value
- must not be null.@Nullable List<byte[]> mGet(byte[]... keys)
keys
. Values are in the order of the requested keys Absent field values are represented using
null
in the resulting List
.keys
- must not be null.null
when used in pipeline / transaction.@Nullable Boolean set(byte[] key, byte[] value)
value
for key
.key
- must not be null.value
- must not be null.@Nullable Boolean set(byte[] key, byte[] value, Expiration expiration, RedisStringCommands.SetOption option)
value
for key
applying timeouts from expiration
if set and inserting/updating values
depending on option
.key
- must not be null.value
- must not be null.expiration
- must not be null. Use Expiration.persistent()
to not set any ttl or
Expiration.keepTtl()
to keep the existing expiration.option
- must not be null. Use RedisStringCommands.SetOption.upsert()
to add non existing.@Nullable Boolean setNX(byte[] key, byte[] value)
value
for key
, only if key
does not exist.key
- must not be null.value
- must not be null.@Nullable Boolean setEx(byte[] key, long seconds, byte[] value)
value
and expiration in seconds
for key
.key
- must not be null.seconds
- value
- must not be null.@Nullable Boolean pSetEx(byte[] key, long milliseconds, byte[] value)
value
and expiration in milliseconds
for key
.key
- must not be null.milliseconds
- value
- must not be null.@Nullable Boolean mSet(Map<byte[],byte[]> tuple)
tuple
.tuple
- must not be null.@Nullable Boolean mSetNX(Map<byte[],byte[]> tuple)
tuple
only if the provided key does
not exist.tuple
- must not be null.@Nullable Long incr(byte[] key)
key
by 1.key
- must not be null.@Nullable Long incrBy(byte[] key, long value)
key
by delta
.key
- must not be null.value
- @Nullable Double incrBy(byte[] key, double value)
key
by delta
.key
- must not be null.value
- @Nullable Long decr(byte[] key)
key
by 1.key
- must not be null.@Nullable Long decrBy(byte[] key, long value)
key
by value
.key
- must not be null.value
- @Nullable Long append(byte[] key, byte[] value)
value
to key
.key
- must not be null.value
- must not be null.@Nullable byte[] getRange(byte[] key, long start, long end)
key
between start
and end
.key
- must not be null.start
- end
- void setRange(byte[] key, byte[] value, long offset)
key
starting at the specified offset
with given value
.key
- must not be null.value
- offset
- @Nullable Boolean getBit(byte[] key, long offset)
offset
of value at key
.key
- must not be null.offset
- @Nullable Boolean setBit(byte[] key, long offset, boolean value)
offset
in value stored at key
.key
- must not be null.offset
- value
- offset
or null when used in pipeline / transaction.@Nullable Long bitCount(byte[] key)
key
.key
- must not be null.@Nullable Long bitCount(byte[] key, long start, long end)
key
between start
and
end
.key
- must not be null.start
- end
- @Nullable List<Long> bitField(byte[] key, BitFieldSubCommands subCommands)
key
.key
- must not be null.subCommands
- must not be null.@Nullable Long bitOp(RedisStringCommands.BitOperation op, byte[] destination, byte[]... keys)
op
- must not be null.destination
- must not be null.keys
- must not be null.@Nullable default Long bitPos(byte[] key, boolean bit)
bit
in a string.key
- the key holding the actual String.bit
- the bit value to look for.@Nullable Long bitPos(byte[] key, boolean bit, org.springframework.data.domain.Range<Long> range)
bit
in a string. Range
start and end can contain
negative values in order to index bytes starting from the end of the string, where -1
is the last byte, -2 is the penultimate.key
- the key holding the actual String.bit
- the bit value to look for.range
- must not be null. Use Range.unbounded()
to not limit search.@Nullable Long strLen(byte[] key)
key
.key
- must not be null.Copyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.