public class BinaryJedis extends java.lang.Object implements BasicCommands, BinaryJedisCommands, MultiKeyBinaryCommands, AdvancedBinaryJedisCommands, BinaryScriptingCommands, java.io.Closeable
构造器和说明 |
---|
BinaryJedis() |
BinaryJedis(HostAndPort hp) |
BinaryJedis(HostAndPort hostPort,
JedisClientConfig config) |
BinaryJedis(JedisShardInfo shardInfo) |
BinaryJedis(JedisSocketFactory jedisSocketFactory)
已过时。
This constructor will be removed in future major release.
Use
BinaryJedis(redis.clients.jedis.JedisSocketFactory, redis.clients.jedis.JedisClientConfig) . |
BinaryJedis(JedisSocketFactory jedisSocketFactory,
JedisClientConfig clientConfig) |
BinaryJedis(java.lang.String uriString)
已过时。
This constructor will not support a host string in future. It will accept only a
uri string.
JedisURIHelper.isValid(java.net.URI) can used before this. If this
constructor was being used with a host, it can be replaced with
BinaryJedis(java.lang.String, int) with the host and Protocol.DEFAULT_PORT . |
BinaryJedis(java.lang.String host,
int port) |
BinaryJedis(java.lang.String host,
int port,
boolean ssl) |
BinaryJedis(java.lang.String host,
int port,
boolean ssl,
javax.net.ssl.SSLSocketFactory sslSocketFactory,
javax.net.ssl.SSLParameters sslParameters,
javax.net.ssl.HostnameVerifier hostnameVerifier) |
BinaryJedis(java.lang.String host,
int port,
int timeout) |
BinaryJedis(java.lang.String host,
int port,
int timeout,
boolean ssl) |
BinaryJedis(java.lang.String host,
int port,
int timeout,
boolean ssl,
javax.net.ssl.SSLSocketFactory sslSocketFactory,
javax.net.ssl.SSLParameters sslParameters,
javax.net.ssl.HostnameVerifier hostnameVerifier) |
BinaryJedis(java.lang.String host,
int port,
int connectionTimeout,
int soTimeout) |
BinaryJedis(java.lang.String host,
int port,
int connectionTimeout,
int soTimeout,
boolean ssl) |
BinaryJedis(java.lang.String host,
int port,
int connectionTimeout,
int soTimeout,
boolean ssl,
javax.net.ssl.SSLSocketFactory sslSocketFactory,
javax.net.ssl.SSLParameters sslParameters,
javax.net.ssl.HostnameVerifier hostnameVerifier) |
BinaryJedis(java.lang.String host,
int port,
int connectionTimeout,
int soTimeout,
int infiniteSoTimeout) |
BinaryJedis(java.lang.String host,
int port,
int connectionTimeout,
int soTimeout,
int infiniteSoTimeout,
boolean ssl,
javax.net.ssl.SSLSocketFactory sslSocketFactory,
javax.net.ssl.SSLParameters sslParameters,
javax.net.ssl.HostnameVerifier hostnameVerifier) |
BinaryJedis(java.lang.String host,
int port,
JedisClientConfig config) |
BinaryJedis(java.net.URI uri) |
BinaryJedis(java.net.URI uri,
int timeout) |
BinaryJedis(java.net.URI uri,
int connectionTimeout,
int soTimeout) |
BinaryJedis(java.net.URI uri,
int connectionTimeout,
int soTimeout,
int infiniteSoTimeout,
javax.net.ssl.SSLSocketFactory sslSocketFactory,
javax.net.ssl.SSLParameters sslParameters,
javax.net.ssl.HostnameVerifier hostnameVerifier) |
BinaryJedis(java.net.URI uri,
int connectionTimeout,
int soTimeout,
javax.net.ssl.SSLSocketFactory sslSocketFactory,
javax.net.ssl.SSLParameters sslParameters,
javax.net.ssl.HostnameVerifier hostnameVerifier) |
BinaryJedis(java.net.URI uri,
int timeout,
javax.net.ssl.SSLSocketFactory sslSocketFactory,
javax.net.ssl.SSLParameters sslParameters,
javax.net.ssl.HostnameVerifier hostnameVerifier) |
BinaryJedis(java.net.URI uri,
JedisClientConfig config) |
BinaryJedis(java.net.URI uri,
javax.net.ssl.SSLSocketFactory sslSocketFactory,
javax.net.ssl.SSLParameters sslParameters,
javax.net.ssl.HostnameVerifier hostnameVerifier) |
限定符和类型 | 方法和说明 |
---|---|
java.util.List<byte[]> |
aclCat(byte[] category) |
java.util.List<byte[]> |
aclCatBinary() |
java.lang.Long |
aclDelUser(byte[] name) |
byte[] |
aclGenPassBinary() |
AccessControlUser |
aclGetUser(byte[] name) |
java.util.List<byte[]> |
aclListBinary() |
java.lang.String |
aclLoad() |
byte[] |
aclLog(byte[] options) |
java.util.List<byte[]> |
aclLogBinary() |
java.util.List<byte[]> |
aclLogBinary(int limit) |
java.lang.String |
aclSave() |
java.lang.String |
aclSetUser(byte[] name) |
java.lang.String |
aclSetUser(byte[] name,
byte[]... keys) |
java.util.List<byte[]> |
aclUsersBinary() |
byte[] |
aclWhoAmIBinary() |
java.lang.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.
|
java.lang.String |
auth(java.lang.String password)
Request for authentication in a password protected Redis server.
|
java.lang.String |
auth(java.lang.String user,
java.lang.String password)
Request for authentication with a Redis Server that is using ACL where user are authenticated with
username and password.
|
java.lang.String |
bgrewriteaof()
Rewrite the append only file in background when it gets too big.
|
java.lang.String |
bgsave()
Asynchronously save the DB on disk.
|
java.lang.Long |
bitcount(byte[] key) |
java.lang.Long |
bitcount(byte[] key,
long start,
long end) |
java.util.List<java.lang.Long> |
bitfield(byte[] key,
byte[]... arguments)
Executes BITFIELD Redis command
|
java.util.List<java.lang.Long> |
bitfieldReadonly(byte[] key,
byte[]... arguments) |
java.lang.Long |
bitop(BitOP op,
byte[] destKey,
byte[]... srcKeys) |
java.lang.Long |
bitpos(byte[] key,
boolean value) |
java.lang.Long |
bitpos(byte[] key,
boolean value,
BitPosParams params) |
byte[] |
blmove(byte[] srcKey,
byte[] dstKey,
ListDirection from,
ListDirection to,
double timeout)
Pop an element from a list, push it to another list and return it; or block until one is available
|
java.util.List<byte[]> |
blpop(byte[]... args) |
java.util.List<byte[]> |
blpop(double timeout,
byte[]... keys) |
java.util.List<byte[]> |
blpop(int timeout,
byte[]... keys)
BLPOP (and BRPOP) is a blocking list pop primitive.
|
java.util.List<byte[]> |
brpop(byte[]... args) |
java.util.List<byte[]> |
brpop(double timeout,
byte[]... keys) |
java.util.List<byte[]> |
brpop(int timeout,
byte[]... keys)
BLPOP (and BRPOP) is a blocking list pop primitive.
|
byte[] |
brpoplpush(byte[] source,
byte[] destination,
int timeout)
Pop a value from a list, push it to another list and return it; or block until one is available
|
java.util.List<byte[]> |
bzpopmax(double timeout,
byte[]... keys) |
java.util.List<byte[]> |
bzpopmin(double timeout,
byte[]... keys) |
byte[] |
clientGetnameBinary() |
java.lang.Long |
clientId() |
byte[] |
clientInfoBinary() |
java.lang.String |
clientKill(byte[] ipPort) |
java.lang.Long |
clientKill(ClientKillParams params) |
java.lang.String |
clientKill(java.lang.String ip,
int port) |
byte[] |
clientListBinary() |
byte[] |
clientListBinary(long... clientIds) |
java.lang.String |
clientPause(long timeout) |
java.lang.String |
clientSetname(byte[] name) |
java.lang.Long |
clientUnblock(long clientId,
UnblockType unblockType)
Unblock a client blocked in a blocking command from a different connection.
|
void |
close() |
java.util.List<byte[]> |
configGet(byte[] pattern)
Retrieve the configuration of a running Redis server.
|
java.lang.String |
configResetStat()
Reset the stats returned by INFO
|
java.lang.String |
configRewrite()
The CONFIG REWRITE command rewrites the redis.conf file the server was started with, applying
the minimal changes needed to make it reflect the configuration currently used by the server,
which may be different compared to the original one because of the use of the CONFIG SET
command.
|
byte[] |
configSet(byte[] parameter,
byte[] value)
Alter the configuration of a running Redis server.
|
void |
connect() |
java.lang.Boolean |
copy(byte[] srcKey,
byte[] dstKey,
boolean replace)
COPY source destination [DB destination-db] [REPLACE]
|
java.lang.Boolean |
copy(byte[] srcKey,
byte[] dstKey,
int db,
boolean replace)
COPY source destination [DB destination-db] [REPLACE]
|
java.lang.Long |
dbSize()
Return the number of keys in the currently selected database.
|
java.lang.String |
debug(DebugParams params) |
java.lang.Long |
decr(byte[] key)
Decrement the number stored at key by one.
|
java.lang.Long |
decrBy(byte[] key,
long decrement)
DECRBY work just like
INCR but instead to decrement by 1 the decrement is
integer. |
java.lang.Long |
del(byte[]... keys)
Remove the specified keys.
|
java.lang.Long |
del(byte[] key) |
void |
disconnect() |
byte[] |
dump(byte[] key) |
byte[] |
echo(byte[] string) |
java.lang.Object |
eval(byte[] script) |
java.lang.Object |
eval(byte[] script,
byte[] keyCount,
byte[]... params) |
java.lang.Object |
eval(byte[] script,
int keyCount,
byte[]... params) |
java.lang.Object |
eval(byte[] script,
java.util.List<byte[]> keys,
java.util.List<byte[]> args)
Evaluates scripts using the Lua interpreter built into Redis starting from version 2.6.0.
|
java.lang.Object |
evalsha(byte[] sha1) |
java.lang.Object |
evalsha(byte[] sha1,
int keyCount,
byte[]... params) |
java.lang.Object |
evalsha(byte[] sha1,
java.util.List<byte[]> keys,
java.util.List<byte[]> args) |
java.lang.Long |
exists(byte[]... keys)
Test if the specified keys exist.
|
java.lang.Boolean |
exists(byte[] key)
Test if the specified key exists.
|
java.lang.Long |
expire(byte[] key,
long seconds)
Set a timeout on the specified key.
|
java.lang.Long |
expireAt(byte[] key,
long unixTime)
EXPIREAT works exactly like
EXPIRE but instead to get the number of
seconds representing the Time To Live of the key as a second argument (that is a relative way
of specifying the TTL), it takes an absolute one in the form of a UNIX timestamp (Number of
seconds elapsed since 1 Gen 1970). |
java.lang.String |
flushAll()
Delete all the keys of all the existing databases, not just the currently selected one.
|
java.lang.String |
flushAll(FlushMode flushMode)
Delete all the keys of all the existing databases, not just the currently selected one.
|
java.lang.String |
flushDB()
Delete all the keys of the currently selected DB.
|
java.lang.String |
flushDB(FlushMode flushMode)
Delete all the keys of the currently selected DB.
|
java.lang.Long |
geoadd(byte[] key,
double longitude,
double latitude,
byte[] member) |
java.lang.Long |
geoadd(byte[] key,
GeoAddParams params,
java.util.Map<byte[],GeoCoordinate> memberCoordinateMap) |
java.lang.Long |
geoadd(byte[] key,
java.util.Map<byte[],GeoCoordinate> memberCoordinateMap) |
java.lang.Double |
geodist(byte[] key,
byte[] member1,
byte[] member2) |
java.lang.Double |
geodist(byte[] key,
byte[] member1,
byte[] member2,
GeoUnit unit) |
java.util.List<byte[]> |
geohash(byte[] key,
byte[]... members) |
java.util.List<GeoCoordinate> |
geopos(byte[] key,
byte[]... members) |
java.util.List<GeoRadiusResponse> |
georadius(byte[] key,
double longitude,
double latitude,
double radius,
GeoUnit unit) |
java.util.List<GeoRadiusResponse> |
georadius(byte[] key,
double longitude,
double latitude,
double radius,
GeoUnit unit,
GeoRadiusParam param) |
java.util.List<GeoRadiusResponse> |
georadiusByMember(byte[] key,
byte[] member,
double radius,
GeoUnit unit) |
java.util.List<GeoRadiusResponse> |
georadiusByMember(byte[] key,
byte[] member,
double radius,
GeoUnit unit,
GeoRadiusParam param) |
java.util.List<GeoRadiusResponse> |
georadiusByMemberReadonly(byte[] key,
byte[] member,
double radius,
GeoUnit unit) |
java.util.List<GeoRadiusResponse> |
georadiusByMemberReadonly(byte[] key,
byte[] member,
double radius,
GeoUnit unit,
GeoRadiusParam param) |
java.lang.Long |
georadiusByMemberStore(byte[] key,
byte[] member,
double radius,
GeoUnit unit,
GeoRadiusParam param,
GeoRadiusStoreParam storeParam) |
java.util.List<GeoRadiusResponse> |
georadiusReadonly(byte[] key,
double longitude,
double latitude,
double radius,
GeoUnit unit) |
java.util.List<GeoRadiusResponse> |
georadiusReadonly(byte[] key,
double longitude,
double latitude,
double radius,
GeoUnit unit,
GeoRadiusParam param) |
java.lang.Long |
georadiusStore(byte[] key,
double longitude,
double latitude,
double radius,
GeoUnit unit,
GeoRadiusParam param,
GeoRadiusStoreParam storeParam) |
byte[] |
get(byte[] key)
Get the value of the specified key.
|
java.lang.Boolean |
getbit(byte[] key,
long offset)
Returns the bit value at offset in the string value stored at key
|
Client |
getClient() |
int |
getDB()
Return the index of the current database
|
byte[] |
getDel(byte[] key)
Get the value of key and delete the key.
|
byte[] |
getEx(byte[] key,
GetExParams params) |
byte[] |
getrange(byte[] key,
long startOffset,
long endOffset) |
byte[] |
getSet(byte[] key,
byte[] value)
GETSET is an atomic set this value and return the old value command.
|
java.lang.Long |
hdel(byte[] key,
byte[]... fields)
Remove the specified field from an hash stored at key.
|
java.lang.Boolean |
hexists(byte[] key,
byte[] field)
Test for existence of a specified field in a hash.
|
byte[] |
hget(byte[] key,
byte[] field)
If key holds a hash, retrieve the value associated to the specified field.
|
java.util.Map<byte[],byte[]> |
hgetAll(byte[] key)
Return all the fields and associated values in a hash.
|
java.lang.Long |
hincrBy(byte[] key,
byte[] field,
long value)
Increment the number stored at field in the hash at key by value.
|
java.lang.Double |
hincrByFloat(byte[] key,
byte[] field,
double value)
Increment the number stored at field in the hash at key by a double precision floating point
value.
|
java.util.Set<byte[]> |
hkeys(byte[] key)
Return all the fields in a hash.
|
java.lang.Long |
hlen(byte[] key)
Return the number of items in a hash.
|
java.util.List<byte[]> |
hmget(byte[] key,
byte[]... fields)
Retrieve the values associated to the specified fields.
|
java.lang.String |
hmset(byte[] key,
java.util.Map<byte[],byte[]> hash)
Set the respective fields to the respective values.
|
byte[] |
hrandfield(byte[] key)
Get one random field from a hash.
|
java.util.List<byte[]> |
hrandfield(byte[] key,
long count)
Get multiple random fields from a hash.
|
java.util.Map<byte[],byte[]> |
hrandfieldWithValues(byte[] key,
long count)
Get one or multiple random fields with values from a hash.
|
ScanResult<java.util.Map.Entry<byte[],byte[]>> |
hscan(byte[] key,
byte[] cursor) |
ScanResult<java.util.Map.Entry<byte[],byte[]>> |
hscan(byte[] key,
byte[] cursor,
ScanParams params) |
java.lang.Long |
hset(byte[] key,
byte[] field,
byte[] value)
Set the specified hash field to the specified value.
|
java.lang.Long |
hset(byte[] key,
java.util.Map<byte[],byte[]> hash) |
java.lang.Long |
hsetnx(byte[] key,
byte[] field,
byte[] value)
Set the specified hash field to the specified value if the field not exists.
|
java.lang.Long |
hstrlen(byte[] key,
byte[] field)
Used for HSTRLEN Redis command
|
java.util.List<byte[]> |
hvals(byte[] key)
Return all the values in a hash.
|
java.lang.Long |
incr(byte[] key)
Increment the number stored at key by one.
|
java.lang.Long |
incrBy(byte[] key,
long increment)
INCRBY work just like
INCR but instead to increment by 1 the increment is
integer. |
java.lang.Double |
incrByFloat(byte[] key,
double increment)
INCRBYFLOAT work just like
incrBy(byte[], long) INCRBY} but increments by floats
instead of integers. |
java.lang.String |
info()
Provide information and statistics about the server.
|
java.lang.String |
info(java.lang.String section)
The INFO command returns information and statistics about the server in a format that is simple
to parse by computers and easy to read by humans.
|
boolean |
isBroken() |
boolean |
isConnected() |
java.util.Set<byte[]> |
keys(byte[] pattern)
Returns all the keys matching the glob-style pattern as space separated strings.
|
java.lang.Long |
lastsave()
Return the UNIX time stamp of the last successfully saving of the dataset on disk.
|
byte[] |
lindex(byte[] key,
long index)
Return the specified element of the list stored at the specified key. 0 is the first element, 1
the second and so on.
|
java.lang.Long |
linsert(byte[] key,
ListPosition where,
byte[] pivot,
byte[] value) |
java.lang.Long |
llen(byte[] key)
Return the length of the list stored at the specified key.
|
byte[] |
lmove(byte[] srcKey,
byte[] dstKey,
ListDirection from,
ListDirection to)
Pop an element from a list, push it to another list and return it
|
byte[] |
lpop(byte[] key)
Atomically return and remove the first (LPOP) or last (RPOP) element of the list.
|
java.util.List<byte[]> |
lpop(byte[] key,
int count) |
java.lang.Long |
lpos(byte[] key,
byte[] element)
Returns the index of the first matching element inside a redis list.
|
java.lang.Long |
lpos(byte[] key,
byte[] element,
LPosParams params)
In case there are multiple matches Rank option specifies the "rank" of the element to return.
|
java.util.List<java.lang.Long> |
lpos(byte[] key,
byte[] element,
LPosParams params,
long count)
Count will return list of position of all the first N matching elements.
|
java.lang.Long |
lpush(byte[] key,
byte[]... strings)
Add the string value to the head (LPUSH) or tail (RPUSH) of the list stored at key.
|
java.lang.Long |
lpushx(byte[] key,
byte[]... string) |
java.util.List<byte[]> |
lrange(byte[] key,
long start,
long stop)
Return the specified elements of the list stored at the specified key.
|
java.lang.Long |
lrem(byte[] key,
long count,
byte[] value)
Remove the first count occurrences of the value element from the list.
|
java.lang.String |
lset(byte[] key,
long index,
byte[] value)
Set a new value as the element at index position of the List at key.
|
java.lang.String |
ltrim(byte[] key,
long start,
long stop)
Trim an existing list so that it will contain only the specified range of elements specified.
|
byte[] |
memoryDoctorBinary() |
java.lang.Long |
memoryUsage(byte[] key) |
java.lang.Long |
memoryUsage(byte[] key,
int samples) |
java.util.List<byte[]> |
mget(byte[]... keys)
Get the values of all the specified keys.
|
java.lang.String |
migrate(java.lang.String host,
int port,
byte[] key,
int destinationDb,
int timeout) |
java.lang.String |
migrate(java.lang.String host,
int port,
int destinationDB,
int timeout,
MigrateParams params,
byte[]... keys) |
void |
monitor(JedisMonitor jedisMonitor)
Dump all the received requests in real time.
|
java.lang.Long |
move(byte[] key,
int dbIndex)
Move the specified key from the currently selected DB to the specified destination DB.
|
java.lang.String |
mset(byte[]... keysvalues)
Set the the respective keys to the respective values.
|
java.lang.Long |
msetnx(byte[]... keysvalues)
Set the the respective keys to the respective values.
|
Transaction |
multi() |
byte[] |
objectEncoding(byte[] key) |
java.lang.Long |
objectFreq(byte[] key) |
java.util.List<byte[]> |
objectHelpBinary() |
java.lang.Long |
objectIdletime(byte[] key) |
java.lang.Long |
objectRefcount(byte[] key) |
java.lang.Long |
persist(byte[] key)
Undo a
expire at turning the expire key into a normal key. |
java.lang.Long |
pexpire(byte[] key,
long milliseconds)
Set a timeout on the specified key.
|
java.lang.Long |
pexpireAt(byte[] key,
long millisecondsTimestamp) |
java.lang.Long |
pfadd(byte[] key,
byte[]... elements) |
java.lang.Long |
pfcount(byte[]... keys) |
long |
pfcount(byte[] key) |
java.lang.String |
pfmerge(byte[] destkey,
byte[]... sourcekeys) |
java.lang.String |
ping()
This command is often used to test if a connection is still alive, or to measure latency.
|
byte[] |
ping(byte[] message)
Works same as
ping() but returns argument message instead of PONG . |
Pipeline |
pipelined() |
java.lang.String |
psetex(byte[] key,
long milliseconds,
byte[] value)
PSETEX works exactly like
BinaryJedisCommands.setex(byte[], int, byte[]) with the sole difference that the
expire time is specified in milliseconds instead of seconds. |
void |
psubscribe(BinaryJedisPubSub jedisPubSub,
byte[]... patterns) |
java.lang.Long |
pttl(byte[] key) |
java.lang.Long |
publish(byte[] channel,
byte[] message) |
java.lang.String |
quit()
Ask the server to silently close the connection.
|
byte[] |
randomBinaryKey()
Return a randomly selected key from the currently selected DB.
|
java.lang.String |
rename(byte[] oldkey,
byte[] newkey)
Atomically renames the key oldkey to newkey.
|
java.lang.Long |
renamenx(byte[] oldkey,
byte[] newkey)
Rename oldkey into newkey but fails if the destination key newkey already exists.
|
void |
resetState() |
java.lang.String |
restore(byte[] key,
long ttl,
byte[] serializedValue) |
java.lang.String |
restore(byte[] key,
long ttl,
byte[] serializedValue,
RestoreParams params) |
java.lang.String |
restoreReplace(byte[] key,
long ttl,
byte[] serializedValue) |
byte[] |
rpop(byte[] key)
Atomically return and remove the first (LPOP) or last (RPOP) element of the list.
|
java.util.List<byte[]> |
rpop(byte[] key,
int count) |
byte[] |
rpoplpush(byte[] srckey,
byte[] dstkey)
Atomically return and remove the last (tail) element of the srckey list, and push the element
as the first (head) element of the dstkey list.
|
java.lang.Long |
rpush(byte[] key,
byte[]... strings)
Add the string value to the head (LPUSH) or tail (RPUSH) of the list stored at key.
|
java.lang.Long |
rpushx(byte[] key,
byte[]... string) |
java.lang.Long |
sadd(byte[] key,
byte[]... members)
Add the specified member to the set value stored at key.
|
java.lang.String |
save()
Synchronously save the DB on disk.
|
ScanResult<byte[]> |
scan(byte[] cursor) |
ScanResult<byte[]> |
scan(byte[] cursor,
ScanParams params) |
java.lang.Long |
scard(byte[] key)
Return the set cardinality (number of elements).
|
java.util.List<java.lang.Long> |
scriptExists(byte[]... sha1) |
java.lang.Long |
scriptExists(byte[] sha1) |
java.lang.String |
scriptFlush() |
java.lang.String |
scriptFlush(FlushMode flushMode) |
java.lang.String |
scriptKill() |
byte[] |
scriptLoad(byte[] script) |
java.util.Set<byte[]> |
sdiff(byte[]... keys)
Return the difference between the Set stored at key1 and all the Sets key2, ..., keyN
Example:
key1 = [x, a, b, c]
key2 = [c]
key3 = [a, d]
SDIFF key1,key2,key3 => [x, b]
Non existing keys are considered like empty sets.
|
java.lang.Long |
sdiffstore(byte[] dstkey,
byte[]... keys)
This command works exactly like {@link #sdiff(byte[]...)
|
java.lang.String |
select(int index)
Select the DB with having the specified zero-based numeric index.
|
java.lang.Object |
sendBlockingCommand(ProtocolCommand cmd,
byte[]... args) |
java.lang.Object |
sendCommand(ProtocolCommand cmd) |
java.lang.Object |
sendCommand(ProtocolCommand cmd,
byte[]... args) |
java.lang.String |
set(byte[] key,
byte[] value)
Set the string value as value of the key.
|
java.lang.String |
set(byte[] key,
byte[] value,
SetParams params)
Set the string value as value of the key.
|
java.lang.Boolean |
setbit(byte[] key,
long offset,
boolean value)
Sets or clears the bit at offset in the string value stored at key
|
java.lang.Boolean |
setbit(byte[] key,
long offset,
byte[] value) |
java.lang.String |
setex(byte[] key,
long seconds,
byte[] value)
|
java.lang.Long |
setnx(byte[] key,
byte[] value)
SETNX works exactly like
SET with the only difference that if the
key already exists no operation is performed. |
java.lang.Long |
setrange(byte[] key,
long offset,
byte[] value) |
java.lang.String |
shutdown()
Synchronously save the DB on disk, then shutdown the server.
|
java.util.Set<byte[]> |
sinter(byte[]... keys)
Return the members of a set resulting from the intersection of all the sets hold at the
specified keys.
|
java.lang.Long |
sinterstore(byte[] dstkey,
byte[]... keys)
This commanad works exactly like {@link #sinter(byte[]...)
|
java.lang.Boolean |
sismember(byte[] key,
byte[] member)
Return true if member is a member of the set stored at key, otherwise false is returned.
|
java.lang.String |
slaveof(java.lang.String host,
int port)
Change the replication settings.
|
java.lang.String |
slaveofNoOne()
SLAVEOF NO ONE will stop replication, turning the server into a MASTER, but will not discard
the replication.
|
java.util.List<java.lang.Object> |
slowlogGetBinary() |
java.util.List<java.lang.Object> |
slowlogGetBinary(long entries) |
java.lang.Long |
slowlogLen() |
java.lang.String |
slowlogReset() |
java.util.Set<byte[]> |
smembers(byte[] key)
Return all the members (elements) of the set value stored at key.
|
java.util.List<java.lang.Boolean> |
smismember(byte[] key,
byte[]... members)
Returns whether each member is a member of the set stored at key.
|
java.lang.Long |
smove(byte[] srckey,
byte[] dstkey,
byte[] member)
Move the specified member from the set at srckey to the set at dstkey.
|
java.util.List<byte[]> |
sort(byte[] key)
Sort a Set or a List.
|
java.lang.Long |
sort(byte[] key,
byte[] dstkey)
Sort a Set or a List and Store the Result at dstkey.
|
java.util.List<byte[]> |
sort(byte[] key,
SortingParams sortingParameters)
Sort a Set or a List accordingly to the specified parameters.
|
java.lang.Long |
sort(byte[] key,
SortingParams sortingParameters,
byte[] dstkey)
Sort a Set or a List accordingly to the specified parameters and store the result at dstkey.
|
byte[] |
spop(byte[] key)
Remove a random element from a Set returning it as return value.
|
java.util.Set<byte[]> |
spop(byte[] key,
long count) |
byte[] |
srandmember(byte[] key)
Return a random element from a Set, without removing the element.
|
java.util.List<byte[]> |
srandmember(byte[] key,
int count) |
java.lang.Long |
srem(byte[] key,
byte[]... member)
Remove the specified member from the set value stored at key.
|
ScanResult<byte[]> |
sscan(byte[] key,
byte[] cursor) |
ScanResult<byte[]> |
sscan(byte[] key,
byte[] cursor,
ScanParams params) |
java.lang.Long |
strlen(byte[] key) |
void |
subscribe(BinaryJedisPubSub jedisPubSub,
byte[]... channels) |
byte[] |
substr(byte[] key,
int start,
int end)
Return a subset of the string from offset start to offset end (both offsets are inclusive).
|
java.util.Set<byte[]> |
sunion(byte[]... keys)
Return the members of a set resulting from the union of all the sets hold at the specified
keys.
|
java.lang.Long |
sunionstore(byte[] dstkey,
byte[]... keys)
This command works exactly like {@link #sunion(byte[]...)
|
java.lang.String |
swapDB(int index1,
int index2)
This command swaps two Redis databases, so that immediately all the clients connected to a
given database will see the data of the other database, and the other way around.
|
void |
sync()
已过时。
This will be removed in next major release.
|
java.util.List<java.lang.String> |
time() |
java.lang.String |
toString() |
java.lang.Long |
touch(byte[]... keys)
Alters the last access time of a key(s).
|
java.lang.Long |
touch(byte[] key) |
java.lang.Long |
ttl(byte[] key)
The TTL command returns the remaining time to live in seconds of a key that has an
EXPIRE set. |
java.lang.String |
type(byte[] key)
Return the type of the value stored at key in form of a string.
|
java.lang.Long |
unlink(byte[]... keys)
This command is very similar to DEL: it removes the specified keys.
|
java.lang.Long |
unlink(byte[] key) |
java.lang.String |
unwatch() |
java.lang.Long |
waitReplicas(int replicas,
long timeout)
Syncrhonous replication of Redis as described here: http://antirez.com/news/66 Since Java
Object class has implemented "wait" method, we cannot use it, so I had to change the name of
the method.
|
java.lang.String |
watch(byte[]... keys) |
java.lang.Long |
xack(byte[] key,
byte[] group,
byte[]... ids) |
byte[] |
xadd(byte[] key,
byte[] id,
java.util.Map<byte[],byte[]> hash,
long maxLen,
boolean approximateLength) |
byte[] |
xadd(byte[] key,
java.util.Map<byte[],byte[]> hash,
XAddParams params) |
java.util.List<byte[]> |
xclaim(byte[] key,
byte[] groupname,
byte[] consumername,
long minIdleTime,
long newIdleTime,
int retries,
boolean force,
byte[]... ids) |
java.util.List<byte[]> |
xclaim(byte[] key,
byte[] group,
byte[] consumername,
long minIdleTime,
XClaimParams params,
byte[]... ids) |
java.util.List<byte[]> |
xclaimJustId(byte[] key,
byte[] group,
byte[] consumername,
long minIdleTime,
XClaimParams params,
byte[]... ids) |
java.lang.Long |
xdel(byte[] key,
byte[]... ids) |
java.lang.String |
xgroupCreate(byte[] key,
byte[] consumer,
byte[] id,
boolean makeStream) |
java.lang.Long |
xgroupDelConsumer(byte[] key,
byte[] consumer,
byte[] consumerName) |
java.lang.Long |
xgroupDestroy(byte[] key,
byte[] consumer) |
java.lang.String |
xgroupSetID(byte[] key,
byte[] consumer,
byte[] id) |
java.util.List<StreamConsumersInfo> |
xinfoConsumers(byte[] key,
byte[] group) |
java.util.List<java.lang.Object> |
xinfoConsumersBinary(byte[] key,
byte[] group) |
java.util.List<StreamGroupInfo> |
xinfoGroup(byte[] key) |
java.util.List<java.lang.Object> |
xinfoGroupBinary(byte[] key) |
StreamInfo |
xinfoStream(byte[] key) |
java.lang.Object |
xinfoStreamBinary(byte[] key) |
java.lang.Long |
xlen(byte[] key) |
java.lang.Object |
xpending(byte[] key,
byte[] groupname) |
java.util.List<java.lang.Object> |
xpending(byte[] key,
byte[] groupname,
byte[] start,
byte[] end,
int count,
byte[] consumername) |
java.util.List<java.lang.Object> |
xpending(byte[] key,
byte[] groupname,
XPendingParams params) |
java.util.List<byte[]> |
xrange(byte[] key,
byte[] start,
byte[] end) |
java.util.List<byte[]> |
xrange(byte[] key,
byte[] start,
byte[] end,
int count) |
java.util.List<byte[]> |
xread(int count,
long block,
java.util.Map<byte[],byte[]> streams) |
java.util.List<byte[]> |
xread(XReadParams xReadParams,
java.util.Map.Entry<byte[],byte[]>... streams) |
java.util.List<byte[]> |
xreadGroup(byte[] groupname,
byte[] consumer,
int count,
long block,
boolean noAck,
java.util.Map<byte[],byte[]> streams) |
java.util.List<byte[]> |
xreadGroup(byte[] groupname,
byte[] consumer,
XReadGroupParams xReadGroupParams,
java.util.Map.Entry<byte[],byte[]>... streams) |
java.util.List<byte[]> |
xrevrange(byte[] key,
byte[] end,
byte[] start) |
java.util.List<byte[]> |
xrevrange(byte[] key,
byte[] end,
byte[] start,
int count) |
java.lang.Long |
xtrim(byte[] key,
long maxLen,
boolean approximateLength) |
java.lang.Long |
xtrim(byte[] key,
XTrimParams params) |
java.lang.Long |
zadd(byte[] key,
double score,
byte[] member)
Add the specified member having the specified score to the sorted set stored at key.
|
java.lang.Long |
zadd(byte[] key,
double score,
byte[] member,
ZAddParams params) |
java.lang.Long |
zadd(byte[] key,
java.util.Map<byte[],java.lang.Double> scoreMembers) |
java.lang.Long |
zadd(byte[] key,
java.util.Map<byte[],java.lang.Double> scoreMembers,
ZAddParams params) |
java.lang.Double |
zaddIncr(byte[] key,
double score,
byte[] member,
ZAddParams params) |
java.lang.Long |
zcard(byte[] key)
Return the sorted set cardinality (number of elements).
|
java.lang.Long |
zcount(byte[] key,
byte[] min,
byte[] max) |
java.lang.Long |
zcount(byte[] key,
double min,
double max) |
java.util.Set<byte[]> |
zdiff(byte[]... keys) |
java.lang.Long |
zdiffStore(byte[] dstkey,
byte[]... keys) |
java.util.Set<Tuple> |
zdiffWithScores(byte[]... keys) |
java.lang.Double |
zincrby(byte[] key,
double increment,
byte[] member)
If member already exists in the sorted set adds the increment to its score and updates the
position of the element in the sorted set accordingly.
|
java.lang.Double |
zincrby(byte[] key,
double increment,
byte[] member,
ZIncrByParams params) |
java.util.Set<byte[]> |
zinter(ZParams params,
byte[]... keys)
Intersect multiple sorted sets, This command is similar to ZINTERSTORE, but instead of storing
the resulting sorted set, it is returned to the client.
|
java.lang.Long |
zinterstore(byte[] dstkey,
byte[]... sets)
Creates a union or intersection of N sorted sets given by keys k1 through kN, and stores it at
dstkey.
|
java.lang.Long |
zinterstore(byte[] dstkey,
ZParams params,
byte[]... sets)
Creates a union or intersection of N sorted sets given by keys k1 through kN, and stores it at
dstkey.
|
java.util.Set<Tuple> |
zinterWithScores(ZParams params,
byte[]... keys)
Intersect multiple sorted sets, This command is similar to ZINTERSTORE, but instead of storing
the resulting sorted set, it is returned to the client.
|
java.lang.Long |
zlexcount(byte[] key,
byte[] min,
byte[] max) |
java.util.List<java.lang.Double> |
zmscore(byte[] key,
byte[]... members)
Returns the scores associated with the specified members in the sorted set stored at key.
|
Tuple |
zpopmax(byte[] key) |
java.util.Set<Tuple> |
zpopmax(byte[] key,
int count) |
Tuple |
zpopmin(byte[] key) |
java.util.Set<Tuple> |
zpopmin(byte[] key,
int count) |
byte[] |
zrandmember(byte[] key) |
java.util.Set<byte[]> |
zrandmember(byte[] key,
long count) |
java.util.Set<Tuple> |
zrandmemberWithScores(byte[] key,
long count) |
java.util.Set<byte[]> |
zrange(byte[] key,
long start,
long stop) |
java.util.Set<byte[]> |
zrangeByLex(byte[] key,
byte[] min,
byte[] max) |
java.util.Set<byte[]> |
zrangeByLex(byte[] key,
byte[] min,
byte[] max,
int offset,
int count) |
java.util.Set<byte[]> |
zrangeByScore(byte[] key,
byte[] min,
byte[] max) |
java.util.Set<byte[]> |
zrangeByScore(byte[] key,
byte[] min,
byte[] max,
int offset,
int count) |
java.util.Set<byte[]> |
zrangeByScore(byte[] key,
double min,
double max)
Return the all the elements in the sorted set at key with a score between min and max
(including elements with score equal to min or max).
|
java.util.Set<byte[]> |
zrangeByScore(byte[] key,
double min,
double max,
int offset,
int count)
Return the all the elements in the sorted set at key with a score between min and max
(including elements with score equal to min or max).
|
java.util.Set<Tuple> |
zrangeByScoreWithScores(byte[] key,
byte[] min,
byte[] max) |
java.util.Set<Tuple> |
zrangeByScoreWithScores(byte[] key,
byte[] min,
byte[] max,
int offset,
int count) |
java.util.Set<Tuple> |
zrangeByScoreWithScores(byte[] key,
double min,
double max)
Return the all the elements in the sorted set at key with a score between min and max
(including elements with score equal to min or max).
|
java.util.Set<Tuple> |
zrangeByScoreWithScores(byte[] key,
double min,
double max,
int offset,
int count)
Return the all the elements in the sorted set at key with a score between min and max
(including elements with score equal to min or max).
|
java.util.Set<Tuple> |
zrangeWithScores(byte[] key,
long start,
long stop) |
java.lang.Long |
zrank(byte[] key,
byte[] member)
Return the rank (or index) or member in the sorted set at key, with scores being ordered from
low to high.
|
java.lang.Long |
zrem(byte[] key,
byte[]... members)
Remove the specified member from the sorted set value stored at key.
|
java.lang.Long |
zremrangeByLex(byte[] key,
byte[] min,
byte[] max) |
java.lang.Long |
zremrangeByRank(byte[] key,
long start,
long stop)
Remove all elements in the sorted set at key with rank between start and end.
|
java.lang.Long |
zremrangeByScore(byte[] key,
byte[] min,
byte[] max) |
java.lang.Long |
zremrangeByScore(byte[] key,
double min,
double max)
Remove all the elements in the sorted set at key with a score between min and max (including
elements with score equal to min or max).
|
java.util.Set<byte[]> |
zrevrange(byte[] key,
long start,
long stop) |
java.util.Set<byte[]> |
zrevrangeByLex(byte[] key,
byte[] max,
byte[] min) |
java.util.Set<byte[]> |
zrevrangeByLex(byte[] key,
byte[] max,
byte[] min,
int offset,
int count) |
java.util.Set<byte[]> |
zrevrangeByScore(byte[] key,
byte[] max,
byte[] min) |
java.util.Set<byte[]> |
zrevrangeByScore(byte[] key,
byte[] max,
byte[] min,
int offset,
int count) |
java.util.Set<byte[]> |
zrevrangeByScore(byte[] key,
double max,
double min) |
java.util.Set<byte[]> |
zrevrangeByScore(byte[] key,
double max,
double min,
int offset,
int count) |
java.util.Set<Tuple> |
zrevrangeByScoreWithScores(byte[] key,
byte[] max,
byte[] min) |
java.util.Set<Tuple> |
zrevrangeByScoreWithScores(byte[] key,
byte[] max,
byte[] min,
int offset,
int count) |
java.util.Set<Tuple> |
zrevrangeByScoreWithScores(byte[] key,
double max,
double min) |
java.util.Set<Tuple> |
zrevrangeByScoreWithScores(byte[] key,
double max,
double min,
int offset,
int count) |
java.util.Set<Tuple> |
zrevrangeWithScores(byte[] key,
long start,
long stop) |
java.lang.Long |
zrevrank(byte[] key,
byte[] member)
Return the rank (or index) or member in the sorted set at key, with scores being ordered from
high to low.
|
ScanResult<Tuple> |
zscan(byte[] key,
byte[] cursor) |
ScanResult<Tuple> |
zscan(byte[] key,
byte[] cursor,
ScanParams params) |
java.lang.Double |
zscore(byte[] key,
byte[] member)
Return the score of the specified element of the sorted set at key.
|
java.util.Set<byte[]> |
zunion(ZParams params,
byte[]... keys)
Add multiple sorted sets, This command is similar to ZUNIONSTORE, but instead of storing the
resulting sorted set, it is returned to the client.
|
java.lang.Long |
zunionstore(byte[] dstkey,
byte[]... sets)
Creates a union or intersection of N sorted sets given by keys k1 through kN, and stores it at
dstkey.
|
java.lang.Long |
zunionstore(byte[] dstkey,
ZParams params,
byte[]... sets)
Creates a union or intersection of N sorted sets given by keys k1 through kN, and stores it at
dstkey.
|
java.util.Set<Tuple> |
zunionWithScores(ZParams params,
byte[]... keys)
Add multiple sorted sets with scores, This command is similar to ZUNIONSTORE, but instead of storing the
resulting sorted set, it is returned to the client.
|
expire, restore, restoreReplace, setex, xrange
public BinaryJedis()
@Deprecated public BinaryJedis(java.lang.String uriString)
JedisURIHelper.isValid(java.net.URI)
can used before this. If this
constructor was being used with a host, it can be replaced with
BinaryJedis(java.lang.String, int)
with the host and Protocol.DEFAULT_PORT
.uriString
- public BinaryJedis(HostAndPort hp)
public BinaryJedis(java.lang.String host, int port)
public BinaryJedis(java.lang.String host, int port, JedisClientConfig config)
public BinaryJedis(HostAndPort hostPort, JedisClientConfig config)
public BinaryJedis(java.lang.String host, int port, boolean ssl)
public BinaryJedis(java.lang.String host, int port, boolean ssl, javax.net.ssl.SSLSocketFactory sslSocketFactory, javax.net.ssl.SSLParameters sslParameters, javax.net.ssl.HostnameVerifier hostnameVerifier)
public BinaryJedis(java.lang.String host, int port, int timeout)
public BinaryJedis(java.lang.String host, int port, int timeout, boolean ssl)
public BinaryJedis(java.lang.String host, int port, int timeout, boolean ssl, javax.net.ssl.SSLSocketFactory sslSocketFactory, javax.net.ssl.SSLParameters sslParameters, javax.net.ssl.HostnameVerifier hostnameVerifier)
public BinaryJedis(java.lang.String host, int port, int connectionTimeout, int soTimeout)
public BinaryJedis(java.lang.String host, int port, int connectionTimeout, int soTimeout, int infiniteSoTimeout)
public BinaryJedis(java.lang.String host, int port, int connectionTimeout, int soTimeout, boolean ssl)
public BinaryJedis(java.lang.String host, int port, int connectionTimeout, int soTimeout, boolean ssl, javax.net.ssl.SSLSocketFactory sslSocketFactory, javax.net.ssl.SSLParameters sslParameters, javax.net.ssl.HostnameVerifier hostnameVerifier)
public BinaryJedis(java.lang.String host, int port, int connectionTimeout, int soTimeout, int infiniteSoTimeout, boolean ssl, javax.net.ssl.SSLSocketFactory sslSocketFactory, javax.net.ssl.SSLParameters sslParameters, javax.net.ssl.HostnameVerifier hostnameVerifier)
public BinaryJedis(JedisShardInfo shardInfo)
public BinaryJedis(java.net.URI uri)
public BinaryJedis(java.net.URI uri, javax.net.ssl.SSLSocketFactory sslSocketFactory, javax.net.ssl.SSLParameters sslParameters, javax.net.ssl.HostnameVerifier hostnameVerifier)
public BinaryJedis(java.net.URI uri, int timeout)
public BinaryJedis(java.net.URI uri, int timeout, javax.net.ssl.SSLSocketFactory sslSocketFactory, javax.net.ssl.SSLParameters sslParameters, javax.net.ssl.HostnameVerifier hostnameVerifier)
public BinaryJedis(java.net.URI uri, int connectionTimeout, int soTimeout)
public BinaryJedis(java.net.URI uri, int connectionTimeout, int soTimeout, javax.net.ssl.SSLSocketFactory sslSocketFactory, javax.net.ssl.SSLParameters sslParameters, javax.net.ssl.HostnameVerifier hostnameVerifier)
public BinaryJedis(java.net.URI uri, int connectionTimeout, int soTimeout, int infiniteSoTimeout, javax.net.ssl.SSLSocketFactory sslSocketFactory, javax.net.ssl.SSLParameters sslParameters, javax.net.ssl.HostnameVerifier hostnameVerifier)
public BinaryJedis(java.net.URI uri, JedisClientConfig config)
@Deprecated public BinaryJedis(JedisSocketFactory jedisSocketFactory)
BinaryJedis(redis.clients.jedis.JedisSocketFactory, redis.clients.jedis.JedisClientConfig)
.public BinaryJedis(JedisSocketFactory jedisSocketFactory, JedisClientConfig clientConfig)
public java.lang.String toString()
toString
在类中 java.lang.Object
public boolean isConnected()
public boolean isBroken()
public void connect()
public void disconnect()
public void resetState()
public void close()
close
在接口中 java.io.Closeable
close
在接口中 java.lang.AutoCloseable
public int getDB()
BasicCommands
getDB
在接口中 BasicCommands
public java.lang.Boolean copy(byte[] srcKey, byte[] dstKey, int db, boolean replace)
copy
在接口中 MultiKeyBinaryCommands
srcKey
- the source key.dstKey
- the destination key.db
- replace
- public java.lang.Boolean copy(byte[] srcKey, byte[] dstKey, boolean replace)
copy
在接口中 MultiKeyBinaryCommands
srcKey
- the source key.dstKey
- the destination key.replace
- public java.lang.String ping()
BasicCommands
ping
在接口中 BasicCommands
PONG
public byte[] ping(byte[] message)
ping()
but returns argument message instead of PONG
.message
- public java.lang.String set(byte[] key, byte[] value)
Time complexity: O(1)
set
在接口中 BinaryJedisCommands
key
- value
- public java.lang.String set(byte[] key, byte[] value, SetParams params)
set
在接口中 BinaryJedisCommands
key
- value
- params
- public byte[] get(byte[] key)
Time complexity: O(1)
get
在接口中 BinaryJedisCommands
key
- public byte[] getDel(byte[] key)
Time complexity: O(1)
getDel
在接口中 BinaryJedisCommands
key
- public byte[] getEx(byte[] key, GetExParams params)
getEx
在接口中 BinaryJedisCommands
public java.lang.String quit()
quit
在接口中 BasicCommands
public java.lang.Long exists(byte[]... keys)
exists
在接口中 MultiKeyBinaryCommands
keys
- public java.lang.Boolean exists(byte[] key)
exists
在接口中 BinaryJedisCommands
key
- public java.lang.Long del(byte[]... keys)
del
在接口中 MultiKeyBinaryCommands
keys
- public java.lang.Long del(byte[] key)
del
在接口中 BinaryJedisCommands
public java.lang.Long unlink(byte[]... keys)
Time complexity: O(1) for each key removed regardless of its size. Then the command does O(N) work in a different thread in order to reclaim memory, where N is the number of allocations the deleted objects where composed of.
unlink
在接口中 MultiKeyBinaryCommands
keys
- public java.lang.Long unlink(byte[] key)
unlink
在接口中 BinaryJedisCommands
public java.lang.String type(byte[] key)
type
在接口中 BinaryJedisCommands
key
- public java.lang.String flushDB()
flushDB
在接口中 BasicCommands
public java.lang.String flushDB(FlushMode flushMode)
flushDB
在接口中 BasicCommands
flushMode
- public java.util.Set<byte[]> keys(byte[] pattern)
Note that while the time complexity for this operation is O(n) the constant times are pretty low. For example Redis running on an entry level laptop can scan a 1 million keys database in 40 milliseconds. Still it's better to consider this one of the slow commands that may ruin the DB performance if not used with care.
In other words this command is intended only for debugging and special operations like creating a script to change the DB schema. Don't use it in your normal code. Use Redis Sets in order to group together a subset of objects.
Glob style patterns examples:
Use \ to escape special chars if you want to match them verbatim.
Time complexity: O(n) (with n being the number of keys in the DB, and assuming keys and pattern of limited length)
keys
在接口中 MultiKeyBinaryCommands
pattern
- public byte[] randomBinaryKey()
Time complexity: O(1)
randomBinaryKey
在接口中 MultiKeyBinaryCommands
public java.lang.String rename(byte[] oldkey, byte[] newkey)
Time complexity: O(1)
rename
在接口中 MultiKeyBinaryCommands
oldkey
- newkey
- public java.lang.Long renamenx(byte[] oldkey, byte[] newkey)
Time complexity: O(1)
renamenx
在接口中 MultiKeyBinaryCommands
oldkey
- newkey
- public java.lang.Long dbSize()
dbSize
在接口中 BasicCommands
public java.lang.Long expire(byte[] key, long seconds)
Volatile keys are stored on disk like the other keys, the timeout is persistent too like all the other aspects of the dataset. Saving a dataset containing expires and stopping the server does not stop the flow of time as Redis stores on disk the time when the key will no longer be available as Unix time, and not the remaining seconds.
Since Redis 2.1.3 you can update the value of the timeout of a key already having an expire
set. It is also possible to undo the expire at all turning the key into a normal key using the
PERSIST
command.
Time complexity: O(1)
expire
在接口中 BinaryJedisCommands
key
- seconds
- public java.lang.Long expireAt(byte[] key, long unixTime)
EXPIRE
but instead to get the number of
seconds representing the Time To Live of the key as a second argument (that is a relative way
of specifying the TTL), it takes an absolute one in the form of a UNIX timestamp (Number of
seconds elapsed since 1 Gen 1970).
EXPIREAT was introduced in order to implement the Append Only File persistence mode so that EXPIRE commands are automatically translated into EXPIREAT commands for the append only file. Of course EXPIREAT can also used by programmers that need a way to simply specify that a given key should expire at a given time in the future.
Since Redis 2.1.3 you can update the value of the timeout of a key already having an expire
set. It is also possible to undo the expire at all turning the key into a normal key using the
PERSIST
command.
Time complexity: O(1)
expireAt
在接口中 BinaryJedisCommands
key
- unixTime
- public java.lang.Long ttl(byte[] key)
EXPIRE
set. This introspection capability allows a Redis client to
check how many seconds a given key will continue to be part of the dataset.ttl
在接口中 BinaryJedisCommands
key
- public java.lang.Long touch(byte[]... keys)
touch
在接口中 MultiKeyBinaryCommands
keys
- public java.lang.Long touch(byte[] key)
touch
在接口中 BinaryJedisCommands
public java.lang.String select(int index)
select
在接口中 BasicCommands
index
- public java.lang.String swapDB(int index1, int index2)
BasicCommands
swapDB
在接口中 BasicCommands
public java.lang.Long move(byte[] key, int dbIndex)
move
在接口中 BinaryJedisCommands
key
- dbIndex
- public java.lang.String flushAll()
flushAll
在接口中 BasicCommands
public java.lang.String flushAll(FlushMode flushMode)
flushAll
在接口中 BasicCommands
flushMode
- public byte[] getSet(byte[] key, byte[] value)
Time complexity: O(1)
getSet
在接口中 BinaryJedisCommands
key
- value
- public java.util.List<byte[]> mget(byte[]... keys)
Time complexity: O(1) for every key
mget
在接口中 MultiKeyBinaryCommands
keys
- public java.lang.Long setnx(byte[] key, byte[] value)
SET
with the only difference that if the
key already exists no operation is performed. SETNX actually means "SET if Not eXists".
Time complexity: O(1)
setnx
在接口中 BinaryJedisCommands
key
- value
- public java.lang.String setex(byte[] key, long seconds, byte[] value)
SET
+ EXPIRE
. The operation is
atomic.
Time complexity: O(1)
setex
在接口中 BinaryJedisCommands
key
- seconds
- value
- public java.lang.String mset(byte[]... keysvalues)
MSETNX
will not perform any operation at all even if
just a single key already exists.
Because of this semantic MSETNX can be used in order to set different keys representing different fields of an unique logic object in a way that ensures that either all the fields or none at all are set.
Both MSET and MSETNX are atomic operations. This means that for instance if the keys A and B are modified, another client talking to Redis can either see the changes to both A and B at once, or no modification at all.
mset
在接口中 MultiKeyBinaryCommands
keysvalues
- #msetnx(byte[]...)
public java.lang.Long msetnx(byte[]... keysvalues)
MSET
will
replace old values with new values, while MSETNX will not perform any operation at all even if
just a single key already exists.
Because of this semantic MSETNX can be used in order to set different keys representing different fields of an unique logic object in a way that ensures that either all the fields or none at all are set.
Both MSET and MSETNX are atomic operations. This means that for instance if the keys A and B are modified, another client talking to Redis can either see the changes to both A and B at once, or no modification at all.
msetnx
在接口中 MultiKeyBinaryCommands
keysvalues
- #mset(byte[]...)
public java.lang.Long decrBy(byte[] key, long decrement)
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.
Time complexity: O(1)
decrBy
在接口中 BinaryJedisCommands
key
- decrement
- incr(byte[])
,
decr(byte[])
,
incrBy(byte[], long)
public java.lang.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)
decr
在接口中 BinaryJedisCommands
key
- incr(byte[])
,
incrBy(byte[], long)
,
decrBy(byte[], long)
public java.lang.Long incrBy(byte[] key, long increment)
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.
Time complexity: O(1)
incrBy
在接口中 BinaryJedisCommands
key
- increment
- incr(byte[])
,
decr(byte[])
,
decrBy(byte[], long)
public java.lang.Double incrByFloat(byte[] key, double increment)
incrBy(byte[], long)
INCRBY} but increments by floats
instead of integers.
INCRBYFLOAT commands are limited to double precision floating point values.
Note: this is actually a string operation, that is, in Redis there are not "double" types. Simply the string stored at the key is parsed as a base double precision floating point value, incremented, and then converted back as a string. There is no DECRYBYFLOAT but providing a negative value will work as expected.
Time complexity: O(1)
incrByFloat
在接口中 BinaryJedisCommands
key
- the key to incrementincrement
- the value to increment byincr(byte[])
,
decr(byte[])
,
decrBy(byte[], long)
public java.lang.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.
Time complexity: O(1)
incr
在接口中 BinaryJedisCommands
key
- incrBy(byte[], long)
,
decr(byte[])
,
decrBy(byte[], long)
public java.lang.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.
append
在接口中 BinaryJedisCommands
key
- 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.
Time complexity: O(start+n) (with start being the start index and n the total length of the requested range). Note that the lookup part of this command is O(1) so for small strings this is actually an O(1) command.
substr
在接口中 BinaryJedisCommands
key
- start
- end
- public java.lang.Long hset(byte[] key, byte[] field, byte[] value)
If key does not exist, a new key holding a hash is created.
Time complexity: O(1)
hset
在接口中 BinaryJedisCommands
key
- field
- value
- public java.lang.Long hset(byte[] key, java.util.Map<byte[],byte[]> hash)
hset
在接口中 BinaryJedisCommands
public byte[] hget(byte[] key, byte[] field)
If the field is not found or the key does not exist, a special 'nil' value is returned.
Time complexity: O(1)
hget
在接口中 BinaryJedisCommands
key
- field
- public java.lang.Long hsetnx(byte[] key, byte[] field, byte[] value)
hsetnx
在接口中 BinaryJedisCommands
key
- field
- value
- public java.lang.String hmset(byte[] key, java.util.Map<byte[],byte[]> hash)
If key does not exist, a new key holding a hash is created.
Time complexity: O(N) (with N being the number of fields)
hmset
在接口中 BinaryJedisCommands
key
- hash
- public java.util.List<byte[]> hmget(byte[] key, byte[]... fields)
If some of the specified fields do not exist, nil values are returned. Non existing keys are considered like empty hashes.
Time complexity: O(N) (with N being the number of fields)
hmget
在接口中 BinaryJedisCommands
key
- fields
- public java.lang.Long hincrBy(byte[] key, byte[] field, long value)
The range of values supported by HINCRBY is limited to 64 bit signed integers.
Time complexity: O(1)
hincrBy
在接口中 BinaryJedisCommands
key
- field
- value
- public java.lang.Double hincrByFloat(byte[] key, byte[] field, double value)
The range of values supported by HINCRBYFLOAT is limited to double precision floating point values.
Time complexity: O(1)
hincrByFloat
在接口中 BinaryJedisCommands
key
- field
- value
- public java.lang.Boolean hexists(byte[] key, byte[] field)
hexists
在接口中 BinaryJedisCommands
key
- field
- public java.lang.Long hdel(byte[] key, byte[]... fields)
Time complexity: O(1)
hdel
在接口中 BinaryJedisCommands
key
- fields
- public java.lang.Long hlen(byte[] key)
Time complexity: O(1)
hlen
在接口中 BinaryJedisCommands
key
- public java.util.Set<byte[]> hkeys(byte[] key)
Time complexity: O(N), where N is the total number of entries
hkeys
在接口中 BinaryJedisCommands
key
- public java.util.List<byte[]> hvals(byte[] key)
Time complexity: O(N), where N is the total number of entries
hvals
在接口中 BinaryJedisCommands
key
- public java.util.Map<byte[],byte[]> hgetAll(byte[] key)
Time complexity: O(N), where N is the total number of entries
hgetAll
在接口中 BinaryJedisCommands
key
- public byte[] hrandfield(byte[] key)
Time complexity: O(N), where N is the number of fields returned
hrandfield
在接口中 BinaryJedisCommands
key
- public java.util.List<byte[]> hrandfield(byte[] key, long count)
Time complexity: O(N), where N is the number of fields returned
hrandfield
在接口中 BinaryJedisCommands
key
- public java.util.Map<byte[],byte[]> hrandfieldWithValues(byte[] key, long count)
Time complexity: O(N), where N is the number of fields returned
hrandfieldWithValues
在接口中 BinaryJedisCommands
key
- public java.lang.Long rpush(byte[] key, byte[]... strings)
Time complexity: O(1)
rpush
在接口中 BinaryJedisCommands
key
- strings
- BinaryJedis#rpush(byte[], byte[]...)
public java.lang.Long lpush(byte[] key, byte[]... strings)
Time complexity: O(1)
lpush
在接口中 BinaryJedisCommands
key
- strings
- BinaryJedis#rpush(byte[], byte[]...)
public java.lang.Long llen(byte[] key)
Time complexity: O(1)
llen
在接口中 BinaryJedisCommands
key
- public java.util.List<byte[]> lrange(byte[] key, long start, long stop)
For example LRANGE foobar 0 2 will return the first three elements of the list.
start and end can also be negative numbers indicating offsets from the end of the list. For example -1 is the last element of the list, -2 the penultimate element and so on.
Consistency with range functions in various programming languages
Note that if you have a list of numbers from 0 to 100, LRANGE 0 10 will return 11 elements, that is, rightmost item is included. This may or may not be consistent with behavior of range-related functions in your programming language of choice (think Ruby's Range.new, Array#slice or Python's range() function).
LRANGE behavior is consistent with one of Tcl.
Out-of-range indexes
Indexes out of range will not produce an error: if start is over the end of the list, or start > end, an empty list is returned. If end is over the end of the list Redis will threat it just like the last element of the list.
Time complexity: O(start+n) (with n being the length of the range and start being the start offset)
lrange
在接口中 BinaryJedisCommands
key
- start
- stop
- public java.lang.String ltrim(byte[] key, long start, long stop)
For example LTRIM foobar 0 2 will modify the list stored at foobar key so that only the first three elements of the list will remain.
start and end can also be negative numbers indicating offsets from the end of the list. For example -1 is the last element of the list, -2 the penultimate element and so on.
Indexes out of range will not produce an error: if start is over the end of the list, or start > end, an empty list is left as value. If end over the end of the list Redis will threat it just like the last element of the list.
Hint: the obvious use of LTRIM is together with LPUSH/RPUSH. For example:
lpush("mylist", "someelement"); ltrim("mylist", 0, 99); *
The above two commands will push elements in the list taking care that the list will not grow without limits. This is very useful when using Redis to store logs for example. It is important to note that when used in this way LTRIM is an O(1) operation because in the average case just one element is removed from the tail of the list.
Time complexity: O(n) (with n being len of list - len of range)
ltrim
在接口中 BinaryJedisCommands
key
- start
- stop
- public byte[] lindex(byte[] key, long index)
If the value stored at key is not of list type an error is returned. If the index is out of range a 'nil' reply is returned.
Note that even if the average time complexity is O(n) asking for the first or the last element of the list is O(1).
Time complexity: O(n) (with n being the length of the list)
lindex
在接口中 BinaryJedisCommands
key
- index
- public java.lang.String lset(byte[] key, long index, byte[] value)
Out of range indexes will generate an error.
Similarly to other list commands accepting indexes, the index can be negative to access elements starting from the end of the list. So -1 is the last element, -2 is the penultimate, and so forth.
Time complexity:
O(N) (with N being the length of the list), setting the first or last elements of the list is O(1).
lset
在接口中 BinaryJedisCommands
key
- index
- value
- lindex(byte[], long)
public java.lang.Long lrem(byte[] key, long count, byte[] value)
Time complexity: O(N) (with N being the length of the list)
lrem
在接口中 BinaryJedisCommands
key
- count
- value
- public byte[] lpop(byte[] key)
If the key does not exist or the list is already empty the special value 'nil' is returned.
lpop
在接口中 BinaryJedisCommands
key
- rpop(byte[])
public java.util.List<byte[]> lpop(byte[] key, int count)
lpop
在接口中 BinaryJedisCommands
public java.lang.Long lpos(byte[] key, byte[] element)
Time complexity: O(N) where N is the number of elements in the list
lpos
在接口中 BinaryJedisCommands
key
- element
- lpos(byte[], byte[])
public java.lang.Long lpos(byte[] key, byte[] element, LPosParams params)
Maxlen option compares the element provided only with a given maximum number of list items. A value of 1000 will make sure that the command performs only 1000 comparisons. The comparison is made for the first part or the last part depending on the fact we use a positive or negative rank. Following is how we could use the Maxlen option lpos("foo", "b", LPosParams.lPosParams().rank(1).maxlen(2)).
lpos
在接口中 BinaryJedisCommands
key
- element
- params
- lpos(byte[], byte[], LPosParams)
public java.util.List<java.lang.Long> lpos(byte[] key, byte[] element, LPosParams params, long count)
Time complexity: O(N) where N is the number of elements in the list
lpos
在接口中 BinaryJedisCommands
key
- element
- params
- count
- lpos(byte[], byte[], LPosParams, long)
public byte[] rpop(byte[] key)
If the key does not exist or the list is already empty the special value 'nil' is returned.
rpop
在接口中 BinaryJedisCommands
key
- lpop(byte[])
public java.util.List<byte[]> rpop(byte[] key, int count)
rpop
在接口中 BinaryJedisCommands
public byte[] rpoplpush(byte[] srckey, byte[] dstkey)
If the key does not exist or the list is already empty the special value 'nil' is returned. If the srckey and dstkey are the same the operation is equivalent to removing the last element from the list and pushing it as first element of the list, so it's a "list rotation" command.
Time complexity: O(1)
rpoplpush
在接口中 MultiKeyBinaryCommands
srckey
- dstkey
- public java.lang.Long sadd(byte[] key, byte[]... members)
Time complexity O(1)
sadd
在接口中 BinaryJedisCommands
key
- members
- public java.util.Set<byte[]> smembers(byte[] key)
#sinter(byte[]...)
SINTER}.
Time complexity O(N)
smembers
在接口中 BinaryJedisCommands
key
- the key of the setpublic java.lang.Long srem(byte[] key, byte[]... member)
Time complexity O(1)
srem
在接口中 BinaryJedisCommands
key
- the key of the setmember
- the set member to removepublic byte[] spop(byte[] key)
The srandmember(byte[])
command does a similar work but the returned element is not
removed from the Set.
Time complexity O(1)
spop
在接口中 BinaryJedisCommands
key
- public java.util.Set<byte[]> spop(byte[] key, long count)
spop
在接口中 BinaryJedisCommands
public java.lang.Long smove(byte[] srckey, byte[] dstkey, byte[] member)
If the source set does not exist or does not contain the specified element no operation is performed and zero is returned, otherwise the element is removed from the source set and added to the destination set. On success one is returned, even if the element was already present in the destination set.
An error is raised if the source or destination keys contain a non Set value.
Time complexity O(1)
smove
在接口中 MultiKeyBinaryCommands
srckey
- dstkey
- member
- public java.lang.Long scard(byte[] key)
scard
在接口中 BinaryJedisCommands
key
- public java.lang.Boolean sismember(byte[] key, byte[] member)
Time complexity O(1)
sismember
在接口中 BinaryJedisCommands
key
- member
- public java.util.List<java.lang.Boolean> smismember(byte[] key, byte[]... members)
Time complexity O(N) where N is the number of elements being checked for membership
smismember
在接口中 BinaryJedisCommands
key
- members
- public java.util.Set<byte[]> sinter(byte[]... keys)
lrange(byte[], long, long)
LRANGE} the result is sent to the
client as a multi-bulk reply (see the protocol specification for more information). If just a
single key is specified, then this command produces the same result as
SMEMBERS
. Actually SMEMBERS is just syntax sugar for SINTER.
Non existing keys are considered like empty sets, so if one of the keys is missing an empty set is returned (since the intersection with an empty set always is an empty set).
Time complexity O(N*M) worst case where N is the cardinality of the smallest set and M the number of sets
sinter
在接口中 MultiKeyBinaryCommands
keys
- public java.lang.Long sinterstore(byte[] dstkey, byte[]... keys)
SINTER
but instead of being returned
the resulting set is stored as dstkey.
Time complexity O(N*M) worst case where N is the cardinality of the smallest set and M the number of sets
sinterstore
在接口中 MultiKeyBinaryCommands
dstkey
- keys
- public java.util.Set<byte[]> sunion(byte[]... keys)
lrange(byte[], long, long)
LRANGE} the result is sent to the client as a
multi-bulk reply (see the protocol specification for more information). If just a single key is
specified, then this command produces the same result as SMEMBERS
.
Non existing keys are considered like empty sets.
Time complexity O(N) where N is the total number of elements in all the provided sets
sunion
在接口中 MultiKeyBinaryCommands
keys
- public java.lang.Long sunionstore(byte[] dstkey, byte[]... keys)
SUNION
but instead of being returned
the resulting set is stored as dstkey. Any existing value in dstkey will be over-written.
Time complexity O(N) where N is the total number of elements in all the provided sets
sunionstore
在接口中 MultiKeyBinaryCommands
dstkey
- keys
- public java.util.Set<byte[]> sdiff(byte[]... keys)
Example:
key1 = [x, a, b, c] key2 = [c] key3 = [a, d] SDIFF key1,key2,key3 => [x, b]Non existing keys are considered like empty sets.
Time complexity:
O(N) with N being the total number of elements of all the sets
sdiff
在接口中 MultiKeyBinaryCommands
keys
- public java.lang.Long sdiffstore(byte[] dstkey, byte[]... keys)
SDIFF
but instead of being returned
the resulting set is stored in dstkey.sdiffstore
在接口中 MultiKeyBinaryCommands
dstkey
- keys
- public byte[] srandmember(byte[] key)
The SPOP command does a similar work but the returned element is popped (removed) from the Set.
Time complexity O(1)
srandmember
在接口中 BinaryJedisCommands
key
- public java.util.List<byte[]> srandmember(byte[] key, int count)
srandmember
在接口中 BinaryJedisCommands
public java.lang.Long zadd(byte[] key, double score, byte[] member)
The score value can be the string representation of a double precision floating point number.
Time complexity O(log(N)) with N being the number of elements in the sorted set
zadd
在接口中 BinaryJedisCommands
key
- score
- member
- public java.lang.Long zadd(byte[] key, double score, byte[] member, ZAddParams params)
zadd
在接口中 BinaryJedisCommands
public java.lang.Long zadd(byte[] key, java.util.Map<byte[],java.lang.Double> scoreMembers)
zadd
在接口中 BinaryJedisCommands
public java.lang.Long zadd(byte[] key, java.util.Map<byte[],java.lang.Double> scoreMembers, ZAddParams params)
zadd
在接口中 BinaryJedisCommands
public java.lang.Double zaddIncr(byte[] key, double score, byte[] member, ZAddParams params)
zaddIncr
在接口中 BinaryJedisCommands
public java.util.Set<byte[]> zrange(byte[] key, long start, long stop)
zrange
在接口中 BinaryJedisCommands
public java.lang.Long zrem(byte[] key, byte[]... members)
Time complexity O(log(N)) with N being the number of elements in the sorted set
zrem
在接口中 BinaryJedisCommands
key
- members
- public java.lang.Double zincrby(byte[] key, double increment, byte[] member)
The score value can be the string representation of a double precision floating point number. It's possible to provide a negative value to perform a decrement.
For an introduction to sorted sets check the Introduction to Redis data types page.
Time complexity O(log(N)) with N being the number of elements in the sorted set
zincrby
在接口中 BinaryJedisCommands
key
- increment
- member
- public java.lang.Double zincrby(byte[] key, double increment, byte[] member, ZIncrByParams params)
zincrby
在接口中 BinaryJedisCommands
public java.lang.Long zrank(byte[] key, byte[] member)
When the given member does not exist in the sorted set, the special value 'nil' is returned. The returned rank (or index) of the member is 0-based for both commands.
Time complexity:
O(log(N))
zrank
在接口中 BinaryJedisCommands
key
- member
- zrevrank(byte[], byte[])
public java.lang.Long zrevrank(byte[] key, byte[] member)
When the given member does not exist in the sorted set, the special value 'nil' is returned. The returned rank (or index) of the member is 0-based for both commands.
Time complexity:
O(log(N))
zrevrank
在接口中 BinaryJedisCommands
key
- member
- zrank(byte[], byte[])
public java.util.Set<byte[]> zrevrange(byte[] key, long start, long stop)
zrevrange
在接口中 BinaryJedisCommands
public java.util.Set<Tuple> zrangeWithScores(byte[] key, long start, long stop)
zrangeWithScores
在接口中 BinaryJedisCommands
public java.util.Set<Tuple> zrevrangeWithScores(byte[] key, long start, long stop)
zrevrangeWithScores
在接口中 BinaryJedisCommands
public byte[] zrandmember(byte[] key)
zrandmember
在接口中 BinaryJedisCommands
public java.util.Set<byte[]> zrandmember(byte[] key, long count)
zrandmember
在接口中 BinaryJedisCommands
public java.util.Set<Tuple> zrandmemberWithScores(byte[] key, long count)
zrandmemberWithScores
在接口中 BinaryJedisCommands
public java.lang.Long zcard(byte[] key)
Time complexity O(1)
zcard
在接口中 BinaryJedisCommands
key
- public java.lang.Double zscore(byte[] key, byte[] member)
Time complexity: O(1)
zscore
在接口中 BinaryJedisCommands
key
- member
- public java.util.List<java.lang.Double> zmscore(byte[] key, byte[]... members)
Time complexity: O(N) where N is the number of members being requested.
zmscore
在接口中 BinaryJedisCommands
key
- members
- public Tuple zpopmax(byte[] key)
zpopmax
在接口中 BinaryJedisCommands
public java.util.Set<Tuple> zpopmax(byte[] key, int count)
zpopmax
在接口中 BinaryJedisCommands
public Tuple zpopmin(byte[] key)
zpopmin
在接口中 BinaryJedisCommands
public java.util.Set<Tuple> zpopmin(byte[] key, int count)
zpopmin
在接口中 BinaryJedisCommands
public Transaction multi()
public java.lang.String watch(byte[]... keys)
watch
在接口中 MultiKeyBinaryCommands
public java.lang.String unwatch()
unwatch
在接口中 MultiKeyBinaryCommands
public java.util.List<byte[]> sort(byte[] key)
Sort the elements contained in the List, Set, or Sorted Set value at key. By default sorting is numeric with elements being compared as double precision floating point numbers. This is the simplest form of SORT.
sort
在接口中 BinaryJedisCommands
key
- sort(byte[], byte[])
,
sort(byte[], SortingParams)
,
sort(byte[], SortingParams, byte[])
public java.util.List<byte[]> sort(byte[] key, SortingParams sortingParameters)
examples:
Given are the following sets and key/values:
x = [1, 2, 3] y = [a, b, c] k1 = z k2 = y k3 = x w1 = 9 w2 = 8 w3 = 7Sort Order:
sort(x) or sort(x, sp.asc()) -> [1, 2, 3] sort(x, sp.desc()) -> [3, 2, 1] sort(y) -> [c, a, b] sort(y, sp.alpha()) -> [a, b, c] sort(y, sp.alpha().desc()) -> [c, a, b]Limit (e.g. for Pagination):
sort(x, sp.limit(0, 2)) -> [1, 2] sort(y, sp.alpha().desc().limit(1, 2)) -> [b, a]Sorting by external keys:
sort(x, sb.by(w*)) -> [3, 2, 1] sort(x, sb.by(w*).desc()) -> [1, 2, 3]Getting external keys:
sort(x, sp.by(w*).get(k*)) -> [x, y, z] sort(x, sp.by(w*).get(#).get(k*)) -> [3, x, 2, y, 1, z]
sort
在接口中 BinaryJedisCommands
key
- sortingParameters
- sort(byte[])
,
sort(byte[], SortingParams, byte[])
public java.lang.Long sort(byte[] key, SortingParams sortingParameters, byte[] dstkey)
sort
在接口中 MultiKeyBinaryCommands
key
- sortingParameters
- dstkey
- sort(byte[], SortingParams)
,
sort(byte[])
,
sort(byte[], byte[])
public java.lang.Long sort(byte[] key, byte[] dstkey)
Sort the elements contained in the List, Set, or Sorted Set value at key and store the result at dstkey. By default sorting is numeric with elements being compared as double precision floating point numbers. This is the simplest form of SORT.
sort
在接口中 MultiKeyBinaryCommands
key
- dstkey
- sort(byte[])
,
sort(byte[], SortingParams)
,
sort(byte[], SortingParams, byte[])
public byte[] lmove(byte[] srcKey, byte[] dstKey, ListDirection from, ListDirection to)
lmove
在接口中 MultiKeyBinaryCommands
srcKey
- dstKey
- from
- to
- public byte[] blmove(byte[] srcKey, byte[] dstKey, ListDirection from, ListDirection to, double timeout)
blmove
在接口中 MultiKeyBinaryCommands
srcKey
- dstKey
- from
- to
- timeout
- public java.util.List<byte[]> blpop(int timeout, byte[]... keys)
The following is a description of the exact semantic. We describe BLPOP but the two commands are identical, the only difference is that BLPOP pops the element from the left (head) of the list, and BRPOP pops from the right (tail).
Non blocking behavior
When BLPOP is called, if at least one of the specified keys contain a non empty list, an element is popped from the head of the list and returned to the caller together with the name of the key (BLPOP returns a two elements array, the first element is the key, the second the popped value).
Keys are scanned from left to right, so for instance if you issue BLPOP list1 list2 list3 0 against a dataset where list1 does not exist but list2 and list3 contain non empty lists, BLPOP guarantees to return an element from the list stored at list2 (since it is the first non empty list starting from the left).
Blocking behavior
If none of the specified keys exist or contain non empty lists, BLPOP blocks until some other client performs a LPUSH or an RPUSH operation against one of the lists.
Once new data is present on one of the lists, the client finally returns with the name of the key unblocking it and the popped value.
When blocking, if a non-zero timeout is specified, the client will unblock returning a nil special value if the specified amount of seconds passed without a push operation against at least one of the specified keys.
The timeout argument is interpreted as an integer value. A timeout of zero means instead to block forever.
Multiple clients blocking for the same keys
Multiple clients can block for the same key. They are put into a queue, so the first to be served will be the one that started to wait earlier, in a first-blpopping first-served fashion.
blocking POP inside a MULTI/EXEC transaction
BLPOP and BRPOP can be used with pipelining (sending multiple commands and reading the replies in batch), but it does not make sense to use BLPOP or BRPOP inside a MULTI/EXEC block (a Redis transaction).
The behavior of BLPOP inside MULTI/EXEC when the list is empty is to return a multi-bulk nil reply, exactly what happens when the timeout is reached. If you like science fiction, think at it like if inside MULTI/EXEC the time will flow at infinite speed :)
Time complexity: O(1)
blpop
在接口中 MultiKeyBinaryCommands
timeout
- keys
- When a non-zero timeout is specified, and the BLPOP operation timed out, the return value is a nil multi bulk reply. Most client values will return false or nil accordingly to the programming language used.
#brpop(int, byte[]...)
public java.util.List<byte[]> blpop(double timeout, byte[]... keys)
blpop
在接口中 MultiKeyBinaryCommands
public java.util.List<byte[]> brpop(int timeout, byte[]... keys)
The following is a description of the exact semantic. We describe BLPOP but the two commands are identical, the only difference is that BLPOP pops the element from the left (head) of the list, and BRPOP pops from the right (tail).
Non blocking behavior
When BLPOP is called, if at least one of the specified keys contain a non empty list, an element is popped from the head of the list and returned to the caller together with the name of the key (BLPOP returns a two elements array, the first element is the key, the second the popped value).
Keys are scanned from left to right, so for instance if you issue BLPOP list1 list2 list3 0 against a dataset where list1 does not exist but list2 and list3 contain non empty lists, BLPOP guarantees to return an element from the list stored at list2 (since it is the first non empty list starting from the left).
Blocking behavior
If none of the specified keys exist or contain non empty lists, BLPOP blocks until some other client performs a LPUSH or an RPUSH operation against one of the lists.
Once new data is present on one of the lists, the client finally returns with the name of the key unblocking it and the popped value.
When blocking, if a non-zero timeout is specified, the client will unblock returning a nil special value if the specified amount of seconds passed without a push operation against at least one of the specified keys.
The timeout argument is interpreted as an integer value. A timeout of zero means instead to block forever.
Multiple clients blocking for the same keys
Multiple clients can block for the same key. They are put into a queue, so the first to be served will be the one that started to wait earlier, in a first-blpopping first-served fashion.
blocking POP inside a MULTI/EXEC transaction
BLPOP and BRPOP can be used with pipelining (sending multiple commands and reading the replies in batch), but it does not make sense to use BLPOP or BRPOP inside a MULTI/EXEC block (a Redis transaction).
The behavior of BLPOP inside MULTI/EXEC when the list is empty is to return a multi-bulk nil reply, exactly what happens when the timeout is reached. If you like science fiction, think at it like if inside MULTI/EXEC the time will flow at infinite speed :)
Time complexity: O(1)
brpop
在接口中 MultiKeyBinaryCommands
timeout
- keys
- When a non-zero timeout is specified, and the BLPOP operation timed out, the return value is a nil multi bulk reply. Most client values will return false or nil accordingly to the programming language used.
#blpop(int, byte[]...)
public java.util.List<byte[]> brpop(double timeout, byte[]... keys)
brpop
在接口中 MultiKeyBinaryCommands
public java.util.List<byte[]> blpop(byte[]... args)
blpop
在接口中 MultiKeyBinaryCommands
public java.util.List<byte[]> brpop(byte[]... args)
brpop
在接口中 MultiKeyBinaryCommands
public java.util.List<byte[]> bzpopmax(double timeout, byte[]... keys)
bzpopmax
在接口中 MultiKeyBinaryCommands
public java.util.List<byte[]> bzpopmin(double timeout, byte[]... keys)
bzpopmin
在接口中 MultiKeyBinaryCommands
public java.lang.String auth(java.lang.String password)
auth
在接口中 BasicCommands
password
- public java.lang.String auth(java.lang.String user, java.lang.String password)
auth
在接口中 BasicCommands
user
- password
- public Pipeline pipelined()
public java.lang.Long zcount(byte[] key, double min, double max)
zcount
在接口中 BinaryJedisCommands
public java.lang.Long zcount(byte[] key, byte[] min, byte[] max)
zcount
在接口中 BinaryJedisCommands
public java.util.Set<byte[]> zdiff(byte[]... keys)
zdiff
在接口中 MultiKeyBinaryCommands
public java.util.Set<Tuple> zdiffWithScores(byte[]... keys)
zdiffWithScores
在接口中 MultiKeyBinaryCommands
public java.lang.Long zdiffStore(byte[] dstkey, byte[]... keys)
zdiffStore
在接口中 MultiKeyBinaryCommands
public java.util.Set<byte[]> zrangeByScore(byte[] key, double min, double max)
The elements having the same score are returned sorted lexicographically as ASCII strings (this follows from a property of Redis sorted sets and does not involve further computation).
Using the optional LIMIT
it's possible
to get only a range of the matching elements in an SQL-alike way. Note that if offset is large
the commands needs to traverse the list for offset elements and this adds up to the O(M)
figure.
The ZCOUNT
command is similar to
ZRANGEBYSCORE
but instead of returning the
actual elements in the specified interval, it just returns the number of matching elements.
Exclusive intervals and infinity
min and max can be -inf and +inf, so that you are not required to know what's the greatest or smallest element in order to take, for instance, elements "up to a given value".
Also while the interval is for default closed (inclusive) it's possible to specify open intervals prefixing the score with a "(" character, so for instance:
ZRANGEBYSCORE zset (1.3 5
Will return all the values with score > 1.3 and <= 5, while for instance:
ZRANGEBYSCORE zset (5 (10
Will return all the values with score > 5 and < 10 (5 and 10 excluded).
Time complexity:
O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of elements returned by the command, so if M is constant (for instance you always ask for the first ten elements with LIMIT) you can consider it O(log(N))
zrangeByScore
在接口中 BinaryJedisCommands
key
- min
- max
- zrangeByScore(byte[], double, double)
,
zrangeByScore(byte[], double, double, int, int)
,
zrangeByScoreWithScores(byte[], double, double)
,
zrangeByScoreWithScores(byte[], double, double, int, int)
,
zcount(byte[], double, double)
public java.util.Set<byte[]> zrangeByScore(byte[] key, byte[] min, byte[] max)
zrangeByScore
在接口中 BinaryJedisCommands
public java.util.Set<byte[]> zrangeByScore(byte[] key, double min, double max, int offset, int count)
The elements having the same score are returned sorted lexicographically as ASCII strings (this follows from a property of Redis sorted sets and does not involve further computation).
Using the optional LIMIT
it's possible
to get only a range of the matching elements in an SQL-alike way. Note that if offset is large
the commands needs to traverse the list for offset elements and this adds up to the O(M)
figure.
The ZCOUNT
command is similar to
ZRANGEBYSCORE
but instead of returning the
actual elements in the specified interval, it just returns the number of matching elements.
Exclusive intervals and infinity
min and max can be -inf and +inf, so that you are not required to know what's the greatest or smallest element in order to take, for instance, elements "up to a given value".
Also while the interval is for default closed (inclusive) it's possible to specify open intervals prefixing the score with a "(" character, so for instance:
ZRANGEBYSCORE zset (1.3 5
Will return all the values with score > 1.3 and <= 5, while for instance:
ZRANGEBYSCORE zset (5 (10
Will return all the values with score > 5 and < 10 (5 and 10 excluded).
Time complexity:
O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of elements returned by the command, so if M is constant (for instance you always ask for the first ten elements with LIMIT) you can consider it O(log(N))
zrangeByScore
在接口中 BinaryJedisCommands
key
- min
- max
- offset
- count
- zrangeByScore(byte[], double, double)
,
zrangeByScore(byte[], double, double, int, int)
,
zrangeByScoreWithScores(byte[], double, double)
,
zrangeByScoreWithScores(byte[], double, double, int, int)
,
zcount(byte[], double, double)
public java.util.Set<byte[]> zrangeByScore(byte[] key, byte[] min, byte[] max, int offset, int count)
zrangeByScore
在接口中 BinaryJedisCommands
public java.util.Set<Tuple> zrangeByScoreWithScores(byte[] key, double min, double max)
The elements having the same score are returned sorted lexicographically as ASCII strings (this follows from a property of Redis sorted sets and does not involve further computation).
Using the optional LIMIT
it's possible
to get only a range of the matching elements in an SQL-alike way. Note that if offset is large
the commands needs to traverse the list for offset elements and this adds up to the O(M)
figure.
The ZCOUNT
command is similar to
ZRANGEBYSCORE
but instead of returning the
actual elements in the specified interval, it just returns the number of matching elements.
Exclusive intervals and infinity
min and max can be -inf and +inf, so that you are not required to know what's the greatest or smallest element in order to take, for instance, elements "up to a given value".
Also while the interval is for default closed (inclusive) it's possible to specify open intervals prefixing the score with a "(" character, so for instance:
ZRANGEBYSCORE zset (1.3 5
Will return all the values with score > 1.3 and <= 5, while for instance:
ZRANGEBYSCORE zset (5 (10
Will return all the values with score > 5 and < 10 (5 and 10 excluded).
Time complexity:
O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of elements returned by the command, so if M is constant (for instance you always ask for the first ten elements with LIMIT) you can consider it O(log(N))
zrangeByScoreWithScores
在接口中 BinaryJedisCommands
key
- min
- max
- zrangeByScore(byte[], double, double)
,
zrangeByScore(byte[], double, double, int, int)
,
zrangeByScoreWithScores(byte[], double, double)
,
zrangeByScoreWithScores(byte[], double, double, int, int)
,
zcount(byte[], double, double)
public java.util.Set<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max)
zrangeByScoreWithScores
在接口中 BinaryJedisCommands
public java.util.Set<Tuple> zrangeByScoreWithScores(byte[] key, double min, double max, int offset, int count)
The elements having the same score are returned sorted lexicographically as ASCII strings (this follows from a property of Redis sorted sets and does not involve further computation).
Using the optional LIMIT
it's possible
to get only a range of the matching elements in an SQL-alike way. Note that if offset is large
the commands needs to traverse the list for offset elements and this adds up to the O(M)
figure.
The ZCOUNT
command is similar to
ZRANGEBYSCORE
but instead of returning the
actual elements in the specified interval, it just returns the number of matching elements.
Exclusive intervals and infinity
min and max can be -inf and +inf, so that you are not required to know what's the greatest or smallest element in order to take, for instance, elements "up to a given value".
Also while the interval is for default closed (inclusive) it's possible to specify open intervals prefixing the score with a "(" character, so for instance:
ZRANGEBYSCORE zset (1.3 5
Will return all the values with score > 1.3 and <= 5, while for instance:
ZRANGEBYSCORE zset (5 (10
Will return all the values with score > 5 and < 10 (5 and 10 excluded).
Time complexity:
O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of elements returned by the command, so if M is constant (for instance you always ask for the first ten elements with LIMIT) you can consider it O(log(N))
zrangeByScoreWithScores
在接口中 BinaryJedisCommands
key
- min
- max
- offset
- count
- zrangeByScore(byte[], double, double)
,
zrangeByScore(byte[], double, double, int, int)
,
zrangeByScoreWithScores(byte[], double, double)
,
zrangeByScoreWithScores(byte[], double, double, int, int)
,
zcount(byte[], double, double)
public java.util.Set<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max, int offset, int count)
zrangeByScoreWithScores
在接口中 BinaryJedisCommands
public java.util.Set<byte[]> zrevrangeByScore(byte[] key, double max, double min)
zrevrangeByScore
在接口中 BinaryJedisCommands
public java.util.Set<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min)
zrevrangeByScore
在接口中 BinaryJedisCommands
public java.util.Set<byte[]> zrevrangeByScore(byte[] key, double max, double min, int offset, int count)
zrevrangeByScore
在接口中 BinaryJedisCommands
public java.util.Set<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min, int offset, int count)
zrevrangeByScore
在接口中 BinaryJedisCommands
public java.util.Set<Tuple> zrevrangeByScoreWithScores(byte[] key, double max, double min)
public java.util.Set<Tuple> zrevrangeByScoreWithScores(byte[] key, double max, double min, int offset, int count)
public java.util.Set<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min)
public java.util.Set<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min, int offset, int count)
public java.lang.Long zremrangeByRank(byte[] key, long start, long stop)
Time complexity: O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of elements removed by the operation
zremrangeByRank
在接口中 BinaryJedisCommands
key
- start
- stop
- public java.lang.Long zremrangeByScore(byte[] key, double min, double max)
Time complexity:
O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of elements removed by the operation
zremrangeByScore
在接口中 BinaryJedisCommands
key
- min
- max
- public java.lang.Long zremrangeByScore(byte[] key, byte[] min, byte[] max)
zremrangeByScore
在接口中 BinaryJedisCommands
public java.util.Set<byte[]> zunion(ZParams params, byte[]... keys)
zunion
在接口中 MultiKeyBinaryCommands
params
- keys
- public java.util.Set<Tuple> zunionWithScores(ZParams params, byte[]... keys)
zunionWithScores
在接口中 MultiKeyBinaryCommands
params
- keys
- public java.lang.Long zunionstore(byte[] dstkey, byte[]... sets)
As the terms imply, the #zinterstore(byte[], byte[]...)
ZINTERSTORE} command requires
an element to be present in each of the given inputs to be inserted in the result. The #zunionstore(byte[], byte[]...)
command inserts all elements across all inputs.
Using the WEIGHTS option, it is possible to add weight to each input sorted set. This means that the score of each element in the sorted set is first multiplied by this weight before being passed to the aggregation. When this option is not given, all weights default to 1.
With the AGGREGATE option, it's possible to specify how the results of the union or intersection are aggregated. This option defaults to SUM, where the score of an element is summed across the inputs where it exists. When this option is set to be either MIN or MAX, the resulting set will contain the minimum or maximum score of an element across the inputs where it exists.
Time complexity: O(N) + O(M log(M)) with N being the sum of the sizes of the input sorted sets, and M being the number of elements in the resulting sorted set
zunionstore
在接口中 MultiKeyBinaryCommands
dstkey
- sets
- #zunionstore(byte[], byte[]...)
,
#zunionstore(byte[], ZParams, byte[]...)
,
#zinterstore(byte[], byte[]...)
,
#zinterstore(byte[], ZParams, byte[]...)
public java.lang.Long zunionstore(byte[] dstkey, ZParams params, byte[]... sets)
As the terms imply, the ZINTERSTORE
command requires an
element to be present in each of the given inputs to be inserted in the result. The ZUNIONSTORE
command inserts all elements across all inputs.
Using the WEIGHTS option, it is possible to add weight to each input sorted set. This means that the score of each element in the sorted set is first multiplied by this weight before being passed to the aggregation. When this option is not given, all weights default to 1.
With the AGGREGATE option, it's possible to specify how the results of the union or intersection are aggregated. This option defaults to SUM, where the score of an element is summed across the inputs where it exists. When this option is set to be either MIN or MAX, the resulting set will contain the minimum or maximum score of an element across the inputs where it exists.
Time complexity: O(N) + O(M log(M)) with N being the sum of the sizes of the input sorted sets, and M being the number of elements in the resulting sorted set
zunionstore
在接口中 MultiKeyBinaryCommands
dstkey
- sets
- params
- #zunionstore(byte[], byte[]...)
,
#zunionstore(byte[], ZParams, byte[]...)
,
#zinterstore(byte[], byte[]...)
,
#zinterstore(byte[], ZParams, byte[]...)
public java.util.Set<byte[]> zinter(ZParams params, byte[]... keys)
zinter
在接口中 MultiKeyBinaryCommands
params
- keys
- public java.util.Set<Tuple> zinterWithScores(ZParams params, byte[]... keys)
zinterWithScores
在接口中 MultiKeyBinaryCommands
params
- keys
- public java.lang.Long zinterstore(byte[] dstkey, byte[]... sets)
As the terms imply, the ZINTERSTORE
command requires an
element to be present in each of the given inputs to be inserted in the result. The ZUNIONSTORE
command inserts all elements across all inputs.
Using the WEIGHTS option, it is possible to add weight to each input sorted set. This means that the score of each element in the sorted set is first multiplied by this weight before being passed to the aggregation. When this option is not given, all weights default to 1.
With the AGGREGATE option, it's possible to specify how the results of the union or intersection are aggregated. This option defaults to SUM, where the score of an element is summed across the inputs where it exists. When this option is set to be either MIN or MAX, the resulting set will contain the minimum or maximum score of an element across the inputs where it exists.
Time complexity: O(N) + O(M log(M)) with N being the sum of the sizes of the input sorted sets, and M being the number of elements in the resulting sorted set
zinterstore
在接口中 MultiKeyBinaryCommands
dstkey
- sets
- #zunionstore(byte[], byte[]...)
,
#zunionstore(byte[], ZParams, byte[]...)
,
#zinterstore(byte[], byte[]...)
,
#zinterstore(byte[], ZParams, byte[]...)
public java.lang.Long zinterstore(byte[] dstkey, ZParams params, byte[]... sets)
As the terms imply, the ZINTERSTORE
command requires an
element to be present in each of the given inputs to be inserted in the result. The ZUNIONSTORE
command inserts all elements across all inputs.
Using the WEIGHTS option, it is possible to add weight to each input sorted set. This means that the score of each element in the sorted set is first multiplied by this weight before being passed to the aggregation. When this option is not given, all weights default to 1.
With the AGGREGATE option, it's possible to specify how the results of the union or intersection are aggregated. This option defaults to SUM, where the score of an element is summed across the inputs where it exists. When this option is set to be either MIN or MAX, the resulting set will contain the minimum or maximum score of an element across the inputs where it exists.
Time complexity: O(N) + O(M log(M)) with N being the sum of the sizes of the input sorted sets, and M being the number of elements in the resulting sorted set
zinterstore
在接口中 MultiKeyBinaryCommands
dstkey
- sets
- params
- #zunionstore(byte[], byte[]...)
,
#zunionstore(byte[], ZParams, byte[]...)
,
#zinterstore(byte[], byte[]...)
,
#zinterstore(byte[], ZParams, byte[]...)
public java.lang.Long zlexcount(byte[] key, byte[] min, byte[] max)
zlexcount
在接口中 BinaryJedisCommands
public java.util.Set<byte[]> zrangeByLex(byte[] key, byte[] min, byte[] max)
zrangeByLex
在接口中 BinaryJedisCommands
public java.util.Set<byte[]> zrangeByLex(byte[] key, byte[] min, byte[] max, int offset, int count)
zrangeByLex
在接口中 BinaryJedisCommands
public java.util.Set<byte[]> zrevrangeByLex(byte[] key, byte[] max, byte[] min)
zrevrangeByLex
在接口中 BinaryJedisCommands
public java.util.Set<byte[]> zrevrangeByLex(byte[] key, byte[] max, byte[] min, int offset, int count)
zrevrangeByLex
在接口中 BinaryJedisCommands
public java.lang.Long zremrangeByLex(byte[] key, byte[] min, byte[] max)
zremrangeByLex
在接口中 BinaryJedisCommands
public java.lang.String save()
Save the whole dataset on disk (this means that all the databases are saved, as well as keys with an EXPIRE set (the expire is preserved). The server hangs while the saving is not completed, no connection is served in the meanwhile. An OK code is returned when the DB was fully stored in disk.
The background variant of this command is BGSAVE
that is able to perform the
saving in the background while the server continues serving other clients.
save
在接口中 BasicCommands
public java.lang.String bgsave()
Save the DB in background. The OK code is immediately returned. Redis forks, the parent continues to server the clients, the child saves the DB on disk then exit. A client my be able to check if the operation succeeded using the LASTSAVE command.
bgsave
在接口中 BasicCommands
public java.lang.String bgrewriteaof()
BGREWRITEAOF rewrites the Append Only File in background when it gets too big. The Redis Append Only File is a Journal, so every operation modifying the dataset is logged in the Append Only File (and replayed at startup). This means that the Append Only File always grows. In order to rebuild its content the BGREWRITEAOF creates a new version of the append only file starting directly form the dataset in memory in order to guarantee the generation of the minimal number of commands needed to rebuild the database.
bgrewriteaof
在接口中 BasicCommands
public java.lang.Long lastsave()
Return the UNIX TIME of the last DB save executed with success. A client may check if a
BGSAVE
command succeeded reading the LASTSAVE value, then issuing a BGSAVE
command and checking at regular intervals every N seconds if LASTSAVE changed.
lastsave
在接口中 BasicCommands
public java.lang.String shutdown()
Stop all the clients, save the DB, then quit the server. This commands makes sure that the DB
is switched off without the lost of any data. This is not guaranteed if the client uses simply
SAVE
and then QUIT
because other clients may alter the DB data
between the two commands.
shutdown
在接口中 BasicCommands
public java.lang.String info()
The info command returns different information and statistics about the server in an format that's simple to parse by computers and easy to read by humans.
Format of the returned String:
All the fields are in the form field:value
edis_version:0.07 connected_clients:1 connected_slaves:0 used_memory:3187 changes_since_last_save:0 last_save_time:1237655729 total_connections_received:1 total_commands_processed:1 uptime_in_seconds:25 uptime_in_days:0Notes
used_memory is returned in bytes, and is the total number of bytes allocated by the program using malloc.
uptime_in_days is redundant since the uptime in seconds contains already the full uptime information, this field is only mainly present for humans.
changes_since_last_save does not refer to the number of key changes, but to the number of operations that produced some kind of change in the dataset.
info
在接口中 BasicCommands
public java.lang.String info(java.lang.String section)
BasicCommands
info
在接口中 BasicCommands
section
- (all: Return all sections, default: Return only the default set of sections,
server: General information about the Redis server, clients: Client connections
section, memory: Memory consumption related information, persistence: RDB and AOF
related information, stats: General statistics, replication: Master/slave replication
information, cpu: CPU consumption statistics, commandstats: Redis command statistics,
cluster: Redis Cluster section, keyspace: Database related statistics)public void monitor(JedisMonitor jedisMonitor)
MONITOR is a debugging command that outputs the whole sequence of commands received by the Redis server. is very handy in order to understand what is happening into the database. This command is used directly via telnet.
jedisMonitor
- public java.lang.String slaveof(java.lang.String host, int port)
The SLAVEOF command can change the replication settings of a slave on the fly. If a Redis server is already acting as slave, the command SLAVEOF NO ONE will turn off the replication turning the Redis server into a MASTER. In the proper form SLAVEOF hostname port will make the server a slave of the specific server listening at the specified hostname and port.
If a server is already a slave of some master, SLAVEOF hostname port will stop the replication against the old server and start the synchronization against the new one discarding the old dataset.
The form SLAVEOF no one will stop replication turning the server into a MASTER but will not discard the replication. So if the old master stop working it is possible to turn the slave into a master and set the application to use the new master in read/write. Later when the other Redis server will be fixed it can be configured in order to work as slave.
slaveof
在接口中 BasicCommands
host
- port
- public java.lang.String slaveofNoOne()
BasicCommands
slaveofNoOne
在接口中 BasicCommands
public java.util.List<byte[]> configGet(byte[] pattern)
CONFIG GET returns the current configuration parameters. This sub command only accepts a single argument, that is glob style pattern. All the configuration parameters matching this parameter are reported as a list of key-value pairs.
Example:
$ redis-cli config get '*' 1. "dbfilename" 2. "dump.rdb" 3. "requirepass" 4. (nil) 5. "masterauth" 6. (nil) 7. "maxmemory" 8. "0\n" 9. "appendfsync" 10. "everysec" 11. "save" 12. "3600 1 300 100 60 10000" $ redis-cli config get 'm*' 1. "masterauth" 2. (nil) 3. "maxmemory" 4. "0\n"
configGet
在接口中 AdvancedBinaryJedisCommands
pattern
- public java.lang.String configResetStat()
configResetStat
在接口中 BasicCommands
public java.lang.String configRewrite()
The rewrite is performed in a very conservative way:
CONFIG REWRITE is also able to rewrite the configuration file from scratch if the original one no longer exists for some reason. However if the server was started without a configuration file at all, the CONFIG REWRITE will just return an error.
configRewrite
在接口中 BasicCommands
public byte[] configSet(byte[] parameter, byte[] value)
The list of configuration parameters supported by CONFIG SET can be obtained issuing a
CONFIG GET *
command.
The configuration set using CONFIG SET is immediately loaded by the Redis server that will start acting as specified starting from the next command.
Parameters value format
The value of the configuration parameter is the same as the one of the same parameter in the Redis configuration file, with the following exceptions:
configSet
在接口中 AdvancedBinaryJedisCommands
parameter
- value
- public java.lang.Long strlen(byte[] key)
strlen
在接口中 BinaryJedisCommands
@Deprecated public void sync()
public java.lang.Long lpushx(byte[] key, byte[]... string)
lpushx
在接口中 BinaryJedisCommands
public java.lang.Long persist(byte[] key)
expire
at turning the expire key into a normal key.
Time complexity: O(1)
persist
在接口中 BinaryJedisCommands
key
- public java.lang.Long rpushx(byte[] key, byte[]... string)
rpushx
在接口中 BinaryJedisCommands
public byte[] echo(byte[] string)
echo
在接口中 BinaryJedisCommands
public java.lang.Long linsert(byte[] key, ListPosition where, byte[] pivot, byte[] value)
linsert
在接口中 BinaryJedisCommands
public java.lang.String debug(DebugParams params)
debug
在接口中 BasicCommands
public Client getClient()
public byte[] brpoplpush(byte[] source, byte[] destination, int timeout)
brpoplpush
在接口中 MultiKeyBinaryCommands
source
- destination
- timeout
- public java.lang.Boolean setbit(byte[] key, long offset, boolean value)
setbit
在接口中 BinaryJedisCommands
key
- offset
- value
- public java.lang.Boolean setbit(byte[] key, long offset, byte[] value)
setbit
在接口中 BinaryJedisCommands
public java.lang.Boolean getbit(byte[] key, long offset)
getbit
在接口中 BinaryJedisCommands
key
- offset
- public java.lang.Long bitpos(byte[] key, boolean value)
public java.lang.Long bitpos(byte[] key, boolean value, BitPosParams params)
public java.lang.Long setrange(byte[] key, long offset, byte[] value)
setrange
在接口中 BinaryJedisCommands
public byte[] getrange(byte[] key, long startOffset, long endOffset)
getrange
在接口中 BinaryJedisCommands
public java.lang.Long publish(byte[] channel, byte[] message)
publish
在接口中 MultiKeyBinaryCommands
public void subscribe(BinaryJedisPubSub jedisPubSub, byte[]... channels)
subscribe
在接口中 MultiKeyBinaryCommands
public void psubscribe(BinaryJedisPubSub jedisPubSub, byte[]... patterns)
psubscribe
在接口中 MultiKeyBinaryCommands
public java.lang.Object eval(byte[] script, java.util.List<byte[]> keys, java.util.List<byte[]> args)
eval
在接口中 BinaryScriptingCommands
script
- keys
- args
- public java.lang.Object eval(byte[] script, byte[] keyCount, byte[]... params)
eval
在接口中 BinaryScriptingCommands
public java.lang.Object eval(byte[] script, int keyCount, byte[]... params)
eval
在接口中 BinaryScriptingCommands
public java.lang.Object eval(byte[] script)
eval
在接口中 BinaryScriptingCommands
public java.lang.Object evalsha(byte[] sha1)
evalsha
在接口中 BinaryScriptingCommands
public java.lang.Object evalsha(byte[] sha1, java.util.List<byte[]> keys, java.util.List<byte[]> args)
evalsha
在接口中 BinaryScriptingCommands
public java.lang.Object evalsha(byte[] sha1, int keyCount, byte[]... params)
evalsha
在接口中 BinaryScriptingCommands
public java.lang.String scriptFlush()
scriptFlush
在接口中 BinaryScriptingCommands
public java.lang.String scriptFlush(FlushMode flushMode)
scriptFlush
在接口中 BinaryScriptingCommands
public java.lang.Long scriptExists(byte[] sha1)
public java.util.List<java.lang.Long> scriptExists(byte[]... sha1)
scriptExists
在接口中 BinaryScriptingCommands
public byte[] scriptLoad(byte[] script)
scriptLoad
在接口中 BinaryScriptingCommands
public java.lang.String scriptKill()
scriptKill
在接口中 BinaryScriptingCommands
public java.lang.String slowlogReset()
slowlogReset
在接口中 AdvancedBinaryJedisCommands
public java.lang.Long slowlogLen()
slowlogLen
在接口中 AdvancedBinaryJedisCommands
public java.util.List<java.lang.Object> slowlogGetBinary()
slowlogGetBinary
在接口中 AdvancedBinaryJedisCommands
public java.util.List<java.lang.Object> slowlogGetBinary(long entries)
slowlogGetBinary
在接口中 AdvancedBinaryJedisCommands
public java.lang.Long objectRefcount(byte[] key)
objectRefcount
在接口中 AdvancedBinaryJedisCommands
public byte[] objectEncoding(byte[] key)
objectEncoding
在接口中 AdvancedBinaryJedisCommands
public java.lang.Long objectIdletime(byte[] key)
objectIdletime
在接口中 AdvancedBinaryJedisCommands
public java.util.List<byte[]> objectHelpBinary()
objectHelpBinary
在接口中 AdvancedBinaryJedisCommands
public java.lang.Long objectFreq(byte[] key)
objectFreq
在接口中 AdvancedBinaryJedisCommands
public java.lang.Long bitcount(byte[] key)
bitcount
在接口中 BinaryJedisCommands
public java.lang.Long bitcount(byte[] key, long start, long end)
bitcount
在接口中 BinaryJedisCommands
public java.lang.Long bitop(BitOP op, byte[] destKey, byte[]... srcKeys)
bitop
在接口中 MultiKeyBinaryCommands
public byte[] dump(byte[] key)
dump
在接口中 BinaryJedisCommands
public java.lang.String restore(byte[] key, long ttl, byte[] serializedValue)
restore
在接口中 BinaryJedisCommands
public java.lang.String restoreReplace(byte[] key, long ttl, byte[] serializedValue)
restoreReplace
在接口中 BinaryJedisCommands
public java.lang.String restore(byte[] key, long ttl, byte[] serializedValue, RestoreParams params)
restore
在接口中 BinaryJedisCommands
public java.lang.Long pexpire(byte[] key, long milliseconds)
Volatile keys are stored on disk like the other keys, the timeout is persistent too like all the other aspects of the dataset. Saving a dataset containing expires and stopping the server does not stop the flow of time as Redis stores on disk the time when the key will no longer be available as Unix time, and not the remaining milliseconds.
Since Redis 2.1.3 you can update the value of the timeout of a key already having an expire
set. It is also possible to undo the expire at all turning the key into a normal key using the
PERSIST
command.
Time complexity: O(1)
pexpire
在接口中 BinaryJedisCommands
key
- milliseconds
- public java.lang.Long pexpireAt(byte[] key, long millisecondsTimestamp)
pexpireAt
在接口中 BinaryJedisCommands
public java.lang.Long pttl(byte[] key)
pttl
在接口中 BinaryJedisCommands
public java.lang.String psetex(byte[] key, long milliseconds, byte[] value)
BinaryJedisCommands.setex(byte[], int, byte[])
with the sole difference that the
expire time is specified in milliseconds instead of seconds. Time complexity: O(1)psetex
在接口中 BinaryJedisCommands
key
- milliseconds
- value
- public byte[] memoryDoctorBinary()
public java.lang.Long memoryUsage(byte[] key)
memoryUsage
在接口中 AdvancedBinaryJedisCommands
public java.lang.Long memoryUsage(byte[] key, int samples)
memoryUsage
在接口中 AdvancedBinaryJedisCommands
public byte[] aclWhoAmIBinary()
aclWhoAmIBinary
在接口中 AdvancedBinaryJedisCommands
public byte[] aclGenPassBinary()
aclGenPassBinary
在接口中 AdvancedBinaryJedisCommands
public java.util.List<byte[]> aclListBinary()
aclListBinary
在接口中 AdvancedBinaryJedisCommands
public java.util.List<byte[]> aclUsersBinary()
aclUsersBinary
在接口中 AdvancedBinaryJedisCommands
public AccessControlUser aclGetUser(byte[] name)
aclGetUser
在接口中 AdvancedBinaryJedisCommands
public java.lang.String aclSetUser(byte[] name)
aclSetUser
在接口中 AdvancedBinaryJedisCommands
public java.lang.String aclSetUser(byte[] name, byte[]... keys)
aclSetUser
在接口中 AdvancedBinaryJedisCommands
public java.lang.Long aclDelUser(byte[] name)
aclDelUser
在接口中 AdvancedBinaryJedisCommands
public java.util.List<byte[]> aclCatBinary()
aclCatBinary
在接口中 AdvancedBinaryJedisCommands
public java.util.List<byte[]> aclCat(byte[] category)
aclCat
在接口中 AdvancedBinaryJedisCommands
public java.util.List<byte[]> aclLogBinary()
aclLogBinary
在接口中 AdvancedBinaryJedisCommands
public java.util.List<byte[]> aclLogBinary(int limit)
aclLogBinary
在接口中 AdvancedBinaryJedisCommands
public byte[] aclLog(byte[] options)
aclLog
在接口中 AdvancedBinaryJedisCommands
public java.lang.String aclLoad()
aclLoad
在接口中 AdvancedBinaryJedisCommands
public java.lang.String aclSave()
aclSave
在接口中 AdvancedBinaryJedisCommands
public java.lang.String clientKill(byte[] ipPort)
clientKill
在接口中 AdvancedBinaryJedisCommands
public java.lang.String clientKill(java.lang.String ip, int port)
clientKill
在接口中 AdvancedBinaryJedisCommands
public java.lang.Long clientKill(ClientKillParams params)
clientKill
在接口中 AdvancedBinaryJedisCommands
public byte[] clientGetnameBinary()
public byte[] clientListBinary()
clientListBinary
在接口中 AdvancedBinaryJedisCommands
public byte[] clientListBinary(long... clientIds)
clientListBinary
在接口中 AdvancedBinaryJedisCommands
public byte[] clientInfoBinary()
clientInfoBinary
在接口中 AdvancedBinaryJedisCommands
public java.lang.String clientSetname(byte[] name)
clientSetname
在接口中 AdvancedBinaryJedisCommands
public java.lang.Long clientId()
clientId
在接口中 AdvancedBinaryJedisCommands
public java.lang.Long clientUnblock(long clientId, UnblockType unblockType)
clientUnblock
在接口中 AdvancedBinaryJedisCommands
clientId
- unblockType
- could be null
by default the client is unblocked as if the timeout
of the command was reachedpublic java.lang.String clientPause(long timeout)
public java.util.List<java.lang.String> time()
public java.lang.String migrate(java.lang.String host, int port, byte[] key, int destinationDb, int timeout)
migrate
在接口中 AdvancedBinaryJedisCommands
public java.lang.String migrate(java.lang.String host, int port, int destinationDB, int timeout, MigrateParams params, byte[]... keys)
migrate
在接口中 AdvancedBinaryJedisCommands
public java.lang.Long waitReplicas(int replicas, long timeout)
waitReplicas
在接口中 BasicCommands
replicas
- successfully transferred and acknowledged by at least the specified number of
replicastimeout
- the time to block in milliseconds, a timeout of 0 means to block foreverpublic java.lang.Long pfadd(byte[] key, byte[]... elements)
pfadd
在接口中 BinaryJedisCommands
public long pfcount(byte[] key)
pfcount
在接口中 BinaryJedisCommands
public java.lang.String pfmerge(byte[] destkey, byte[]... sourcekeys)
pfmerge
在接口中 MultiKeyBinaryCommands
public java.lang.Long pfcount(byte[]... keys)
pfcount
在接口中 MultiKeyBinaryCommands
public ScanResult<byte[]> scan(byte[] cursor)
public ScanResult<byte[]> scan(byte[] cursor, ScanParams params)
public ScanResult<java.util.Map.Entry<byte[],byte[]>> hscan(byte[] key, byte[] cursor)
hscan
在接口中 BinaryJedisCommands
public ScanResult<java.util.Map.Entry<byte[],byte[]>> hscan(byte[] key, byte[] cursor, ScanParams params)
hscan
在接口中 BinaryJedisCommands
public ScanResult<byte[]> sscan(byte[] key, byte[] cursor)
sscan
在接口中 BinaryJedisCommands
public ScanResult<byte[]> sscan(byte[] key, byte[] cursor, ScanParams params)
sscan
在接口中 BinaryJedisCommands
public ScanResult<Tuple> zscan(byte[] key, byte[] cursor)
zscan
在接口中 BinaryJedisCommands
public ScanResult<Tuple> zscan(byte[] key, byte[] cursor, ScanParams params)
zscan
在接口中 BinaryJedisCommands
public java.lang.Long geoadd(byte[] key, double longitude, double latitude, byte[] member)
geoadd
在接口中 BinaryJedisCommands
public java.lang.Long geoadd(byte[] key, java.util.Map<byte[],GeoCoordinate> memberCoordinateMap)
geoadd
在接口中 BinaryJedisCommands
public java.lang.Long geoadd(byte[] key, GeoAddParams params, java.util.Map<byte[],GeoCoordinate> memberCoordinateMap)
geoadd
在接口中 BinaryJedisCommands
public java.lang.Double geodist(byte[] key, byte[] member1, byte[] member2)
geodist
在接口中 BinaryJedisCommands
public java.lang.Double geodist(byte[] key, byte[] member1, byte[] member2, GeoUnit unit)
geodist
在接口中 BinaryJedisCommands
public java.util.List<byte[]> geohash(byte[] key, byte[]... members)
geohash
在接口中 BinaryJedisCommands
public java.util.List<GeoCoordinate> geopos(byte[] key, byte[]... members)
geopos
在接口中 BinaryJedisCommands
public java.util.List<GeoRadiusResponse> georadius(byte[] key, double longitude, double latitude, double radius, GeoUnit unit)
georadius
在接口中 BinaryJedisCommands
public java.util.List<GeoRadiusResponse> georadiusReadonly(byte[] key, double longitude, double latitude, double radius, GeoUnit unit)
georadiusReadonly
在接口中 BinaryJedisCommands
public java.util.List<GeoRadiusResponse> georadius(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param)
georadius
在接口中 BinaryJedisCommands
public java.lang.Long georadiusStore(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam)
georadiusStore
在接口中 MultiKeyBinaryCommands
public java.util.List<GeoRadiusResponse> georadiusReadonly(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param)
georadiusReadonly
在接口中 BinaryJedisCommands
public java.util.List<GeoRadiusResponse> georadiusByMember(byte[] key, byte[] member, double radius, GeoUnit unit)
georadiusByMember
在接口中 BinaryJedisCommands
public java.util.List<GeoRadiusResponse> georadiusByMemberReadonly(byte[] key, byte[] member, double radius, GeoUnit unit)
georadiusByMemberReadonly
在接口中 BinaryJedisCommands
public java.util.List<GeoRadiusResponse> georadiusByMember(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param)
georadiusByMember
在接口中 BinaryJedisCommands
public java.lang.Long georadiusByMemberStore(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam)
georadiusByMemberStore
在接口中 MultiKeyBinaryCommands
public java.util.List<GeoRadiusResponse> georadiusByMemberReadonly(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param)
georadiusByMemberReadonly
在接口中 BinaryJedisCommands
public java.util.List<java.lang.Long> bitfield(byte[] key, byte[]... arguments)
BinaryJedisCommands
bitfield
在接口中 BinaryJedisCommands
public java.util.List<java.lang.Long> bitfieldReadonly(byte[] key, byte[]... arguments)
bitfieldReadonly
在接口中 BinaryJedisCommands
public java.lang.Long hstrlen(byte[] key, byte[] field)
BinaryJedisCommands
hstrlen
在接口中 BinaryJedisCommands
public java.util.List<byte[]> xread(int count, long block, java.util.Map<byte[],byte[]> streams)
xread
在接口中 MultiKeyBinaryCommands
public java.util.List<byte[]> xread(XReadParams xReadParams, java.util.Map.Entry<byte[],byte[]>... streams)
xread
在接口中 MultiKeyBinaryCommands
public java.util.List<byte[]> xreadGroup(byte[] groupname, byte[] consumer, int count, long block, boolean noAck, java.util.Map<byte[],byte[]> streams)
xreadGroup
在接口中 MultiKeyBinaryCommands
public java.util.List<byte[]> xreadGroup(byte[] groupname, byte[] consumer, XReadGroupParams xReadGroupParams, java.util.Map.Entry<byte[],byte[]>... streams)
xreadGroup
在接口中 MultiKeyBinaryCommands
public byte[] xadd(byte[] key, byte[] id, java.util.Map<byte[],byte[]> hash, long maxLen, boolean approximateLength)
xadd
在接口中 BinaryJedisCommands
public byte[] xadd(byte[] key, java.util.Map<byte[],byte[]> hash, XAddParams params)
xadd
在接口中 BinaryJedisCommands
public java.lang.Long xlen(byte[] key)
xlen
在接口中 BinaryJedisCommands
public java.util.List<byte[]> xrange(byte[] key, byte[] start, byte[] end)
xrange
在接口中 BinaryJedisCommands
public java.util.List<byte[]> xrange(byte[] key, byte[] start, byte[] end, int count)
xrange
在接口中 BinaryJedisCommands
public java.util.List<byte[]> xrevrange(byte[] key, byte[] end, byte[] start)
xrevrange
在接口中 BinaryJedisCommands
public java.util.List<byte[]> xrevrange(byte[] key, byte[] end, byte[] start, int count)
xrevrange
在接口中 BinaryJedisCommands
public java.lang.Long xack(byte[] key, byte[] group, byte[]... ids)
xack
在接口中 BinaryJedisCommands
public java.lang.String xgroupCreate(byte[] key, byte[] consumer, byte[] id, boolean makeStream)
xgroupCreate
在接口中 BinaryJedisCommands
public java.lang.String xgroupSetID(byte[] key, byte[] consumer, byte[] id)
xgroupSetID
在接口中 BinaryJedisCommands
public java.lang.Long xgroupDestroy(byte[] key, byte[] consumer)
xgroupDestroy
在接口中 BinaryJedisCommands
public java.lang.Long xgroupDelConsumer(byte[] key, byte[] consumer, byte[] consumerName)
xgroupDelConsumer
在接口中 BinaryJedisCommands
public java.lang.Long xdel(byte[] key, byte[]... ids)
xdel
在接口中 BinaryJedisCommands
public java.lang.Long xtrim(byte[] key, long maxLen, boolean approximateLength)
xtrim
在接口中 BinaryJedisCommands
public java.lang.Long xtrim(byte[] key, XTrimParams params)
xtrim
在接口中 BinaryJedisCommands
public java.util.List<java.lang.Object> xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int count, byte[] consumername)
xpending
在接口中 BinaryJedisCommands
public java.lang.Object xpending(byte[] key, byte[] groupname)
xpending
在接口中 BinaryJedisCommands
public java.util.List<java.lang.Object> xpending(byte[] key, byte[] groupname, XPendingParams params)
xpending
在接口中 BinaryJedisCommands
public java.util.List<byte[]> xclaim(byte[] key, byte[] groupname, byte[] consumername, long minIdleTime, long newIdleTime, int retries, boolean force, byte[]... ids)
xclaim
在接口中 BinaryJedisCommands
public java.util.List<byte[]> xclaim(byte[] key, byte[] group, byte[] consumername, long minIdleTime, XClaimParams params, byte[]... ids)
xclaim
在接口中 BinaryJedisCommands
public java.util.List<byte[]> xclaimJustId(byte[] key, byte[] group, byte[] consumername, long minIdleTime, XClaimParams params, byte[]... ids)
xclaimJustId
在接口中 BinaryJedisCommands
public StreamInfo xinfoStream(byte[] key)
xinfoStream
在接口中 BinaryJedisCommands
public java.lang.Object xinfoStreamBinary(byte[] key)
xinfoStreamBinary
在接口中 BinaryJedisCommands
public java.util.List<StreamGroupInfo> xinfoGroup(byte[] key)
xinfoGroup
在接口中 BinaryJedisCommands
public java.util.List<java.lang.Object> xinfoGroupBinary(byte[] key)
xinfoGroupBinary
在接口中 BinaryJedisCommands
public java.util.List<StreamConsumersInfo> xinfoConsumers(byte[] key, byte[] group)
xinfoConsumers
在接口中 BinaryJedisCommands
public java.util.List<java.lang.Object> xinfoConsumersBinary(byte[] key, byte[] group)
xinfoConsumersBinary
在接口中 BinaryJedisCommands
public java.lang.Object sendCommand(ProtocolCommand cmd, byte[]... args)
public java.lang.Object sendBlockingCommand(ProtocolCommand cmd, byte[]... args)
public java.lang.Object sendCommand(ProtocolCommand cmd)