Class BinaryJedis
- java.lang.Object
-
- redis.clients.jedis.BinaryJedis
-
- All Implemented Interfaces:
Closeable,AutoCloseable,AdvancedBinaryJedisCommands,BasicCommands,BinaryJedisCommands,BinaryScriptingCommands,MultiKeyBinaryCommands
- Direct Known Subclasses:
Jedis
public class BinaryJedis extends Object implements BasicCommands, BinaryJedisCommands, MultiKeyBinaryCommands, AdvancedBinaryJedisCommands, BinaryScriptingCommands, Closeable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classBinaryJedis.SetFromList<E>A decorator to implement Set from List.
-
Field Summary
Fields Modifier and Type Field Description protected Clientclientprotected static byte[][]DUMMY_ARRAYprotected Pipelinepipelineprotected Transactiontransaction
-
Constructor Summary
Constructors Constructor Description BinaryJedis()BinaryJedis(String host)BinaryJedis(String host, int port)BinaryJedis(String host, int port, boolean ssl)BinaryJedis(String host, int port, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)BinaryJedis(String host, int port, int timeout)BinaryJedis(String host, int port, int timeout, boolean ssl)BinaryJedis(String host, int port, int timeout, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)BinaryJedis(String host, int port, int connectionTimeout, int soTimeout)BinaryJedis(String host, int port, int connectionTimeout, int soTimeout, boolean ssl)BinaryJedis(String host, int port, int connectionTimeout, int soTimeout, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)BinaryJedis(String host, int port, int connectionTimeout, int soTimeout, int infiniteSoTimeout)BinaryJedis(String host, int port, int connectionTimeout, int soTimeout, int infiniteSoTimeout, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)BinaryJedis(URI uri)BinaryJedis(URI uri, int timeout)BinaryJedis(URI uri, int connectionTimeout, int soTimeout)BinaryJedis(URI uri, int connectionTimeout, int soTimeout, int infiniteSoTimeout, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)BinaryJedis(URI uri, int connectionTimeout, int soTimeout, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)BinaryJedis(URI uri, int timeout, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)BinaryJedis(URI uri, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)BinaryJedis(HostAndPort hp)BinaryJedis(JedisShardInfo shardInfo)BinaryJedis(JedisSocketFactory jedisSocketFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<byte[]>aclCat(byte[] category)List<byte[]>aclCatBinary()LongaclDelUser(byte[] name)byte[]aclGenPassBinary()AccessControlUseraclGetUser(byte[] name)List<byte[]>aclListBinary()byte[]aclLog(byte[] options)List<byte[]>aclLogBinary()List<byte[]>aclLogBinary(int limit)StringaclSetUser(byte[] name)StringaclSetUser(byte[] name, byte[]... keys)List<byte[]>aclUsersBinary()byte[]aclWhoAmIBinary()Longappend(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.Stringauth(String password)Request for authentication in a password protected Redis server.Stringauth(String user, String password)Request for authentication with a Redis Server that is using ACL where user are authenticated with username and password.Stringbgrewriteaof()Rewrite the append only file in background when it gets too big.Stringbgsave()Asynchronously save the DB on disk.Longbitcount(byte[] key)Longbitcount(byte[] key, long start, long end)List<Long>bitfield(byte[] key, byte[]... arguments)Executes BITFIELD Redis commandList<Long>bitfieldReadonly(byte[] key, byte[]... arguments)Longbitop(BitOP op, byte[] destKey, byte[]... srcKeys)Longbitpos(byte[] key, boolean value)Longbitpos(byte[] key, boolean value, BitPosParams params)List<byte[]>blpop(byte[]... args)List<byte[]>blpop(int timeout, byte[]... keys)BLPOP (and BRPOP) is a blocking list pop primitive.List<byte[]>brpop(byte[]... args)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 availableprotected voidcheckIsInMultiOrPipeline()byte[]clientGetnameBinary()LongclientId()StringclientKill(byte[] ipPort)StringclientKill(String ip, int port)LongclientKill(ClientKillParams params)byte[]clientListBinary()StringclientPause(long timeout)StringclientSetname(byte[] name)voidclose()List<byte[]>configGet(byte[] pattern)Retrieve the configuration of a running Redis server.StringconfigResetStat()Reset the stats returned by INFOStringconfigRewrite()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.voidconnect()LongdbSize()Return the number of keys in the currently selected database.Stringdebug(DebugParams params)Longdecr(byte[] key)Decrement the number stored at key by one.LongdecrBy(byte[] key, long decrement)DECRBY work just likeINCRbut instead to decrement by 1 the decrement is integer.Longdel(byte[] key)Longdel(byte[]... keys)Remove the specified keys.voiddisconnect()byte[]dump(byte[] key)byte[]echo(byte[] string)Objecteval(byte[] script)Objecteval(byte[] script, byte[] keyCount, byte[]... params)Objecteval(byte[] script, int keyCount, byte[]... params)Objecteval(byte[] script, List<byte[]> keys, List<byte[]> args)Evaluates scripts using the Lua interpreter built into Redis starting from version 2.6.0.Objectevalsha(byte[] sha1)Objectevalsha(byte[] sha1, int keyCount, byte[]... params)Objectevalsha(byte[] sha1, List<byte[]> keys, List<byte[]> args)Booleanexists(byte[] key)Test if the specified key exists.Longexists(byte[]... keys)Test if the specified keys exist.Longexpire(byte[] key, int seconds)Set a timeout on the specified key.LongexpireAt(byte[] key, long unixTime)EXPIREAT works exactly likeEXPIREbut 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).StringflushAll()Delete all the keys of all the existing databases, not just the currently selected one.StringflushDB()Delete all the keys of the currently selected DB.Longgeoadd(byte[] key, double longitude, double latitude, byte[] member)Longgeoadd(byte[] key, Map<byte[],GeoCoordinate> memberCoordinateMap)Doublegeodist(byte[] key, byte[] member1, byte[] member2)Doublegeodist(byte[] key, byte[] member1, byte[] member2, GeoUnit unit)List<byte[]>geohash(byte[] key, byte[]... members)List<GeoCoordinate>geopos(byte[] key, byte[]... members)List<GeoRadiusResponse>georadius(byte[] key, double longitude, double latitude, double radius, GeoUnit unit)List<GeoRadiusResponse>georadius(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param)List<GeoRadiusResponse>georadiusByMember(byte[] key, byte[] member, double radius, GeoUnit unit)List<GeoRadiusResponse>georadiusByMember(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param)List<GeoRadiusResponse>georadiusByMemberReadonly(byte[] key, byte[] member, double radius, GeoUnit unit)List<GeoRadiusResponse>georadiusByMemberReadonly(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param)LonggeoradiusByMemberStore(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam)List<GeoRadiusResponse>georadiusReadonly(byte[] key, double longitude, double latitude, double radius, GeoUnit unit)List<GeoRadiusResponse>georadiusReadonly(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param)LonggeoradiusStore(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.Booleangetbit(byte[] key, long offset)Returns the bit value at offset in the string value stored at keyClientgetClient()intgetDB()Return the index of the current databaseprotected static byte[][]getParamsWithBinary(List<byte[]> keys, List<byte[]> args)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.protected Set<Tuple>getTupledSet()Longhdel(byte[] key, byte[]... fields)Remove the specified field from an hash stored at key.Booleanhexists(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.Map<byte[],byte[]>hgetAll(byte[] key)Return all the fields and associated values in a hash.LonghincrBy(byte[] key, byte[] field, long value)Increment the number stored at field in the hash at key by value.DoublehincrByFloat(byte[] key, byte[] field, double value)Increment the number stored at field in the hash at key by a double precision floating point value.Set<byte[]>hkeys(byte[] key)Return all the fields in a hash.Longhlen(byte[] key)Return the number of items in a hash.List<byte[]>hmget(byte[] key, byte[]... fields)Retrieve the values associated to the specified fields.Stringhmset(byte[] key, Map<byte[],byte[]> hash)Set the respective fields to the respective values.ScanResult<Map.Entry<byte[],byte[]>>hscan(byte[] key, byte[] cursor)ScanResult<Map.Entry<byte[],byte[]>>hscan(byte[] key, byte[] cursor, ScanParams params)Longhset(byte[] key, byte[] field, byte[] value)Set the specified hash field to the specified value.Longhset(byte[] key, Map<byte[],byte[]> hash)Longhsetnx(byte[] key, byte[] field, byte[] value)Set the specified hash field to the specified value if the field not exists.Longhstrlen(byte[] key, byte[] field)Used for HSTRLEN Redis commandList<byte[]>hvals(byte[] key)Return all the values in a hash.Longincr(byte[] key)Increment the number stored at key by one.LongincrBy(byte[] key, long increment)INCRBY work just likeINCRbut instead to increment by 1 the increment is integer.DoubleincrByFloat(byte[] key, double increment)INCRBYFLOAT work just likeincrBy(byte[], long)INCRBY} but increments by floats instead of integers.Stringinfo()Provide information and statistics about the server.Stringinfo(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.booleanisConnected()Set<byte[]>keys(byte[] pattern)Returns all the keys matching the glob-style pattern as space separated strings.Longlastsave()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.Longlinsert(byte[] key, ListPosition where, byte[] pivot, byte[] value)Longllen(byte[] key)Return the length of the list stored at the specified key.byte[]lpop(byte[] key)Atomically return and remove the first (LPOP) or last (RPOP) element of the list.List<byte[]>lpop(byte[] key, int count)Longlpos(byte[] key, byte[] element)Returns the index of the first matching element inside a redis list.Longlpos(byte[] key, byte[] element, LPosParams params)In case there are multiple matches Rank option specifies the "rank" of the element to return.List<Long>lpos(byte[] key, byte[] element, LPosParams params, long count)Count will return list of position of all the first N matching elements.Longlpush(byte[] key, byte[]... strings)Add the string value to the head (LPUSH) or tail (RPUSH) of the list stored at key.Longlpushx(byte[] key, byte[]... string)List<byte[]>lrange(byte[] key, long start, long stop)Return the specified elements of the list stored at the specified key.Longlrem(byte[] key, long count, byte[] value)Remove the first count occurrences of the value element from the list.Stringlset(byte[] key, long index, byte[] value)Set a new value as the element at index position of the List at key.Stringltrim(byte[] key, long start, long stop)Trim an existing list so that it will contain only the specified range of elements specified.byte[]memoryDoctorBinary()LongmemoryUsage(byte[] key)LongmemoryUsage(byte[] key, int samples)List<byte[]>mget(byte[]... keys)Get the values of all the specified keys.Stringmigrate(String host, int port, byte[] key, int destinationDb, int timeout)Stringmigrate(String host, int port, int destinationDB, int timeout, MigrateParams params, byte[]... keys)voidmonitor(JedisMonitor jedisMonitor)Dump all the received requests in real time.Longmove(byte[] key, int dbIndex)Move the specified key from the currently selected DB to the specified destination DB.Stringmset(byte[]... keysvalues)Set the the respective keys to the respective values.Longmsetnx(byte[]... keysvalues)Set the the respective keys to the respective values.Transactionmulti()byte[]objectEncoding(byte[] key)LongobjectFreq(byte[] key)List<byte[]>objectHelpBinary()LongobjectIdletime(byte[] key)LongobjectRefcount(byte[] key)Longpersist(byte[] key)Undo aexpireat turning the expire key into a normal key.Longpexpire(byte[] key, long milliseconds)Set a timeout on the specified key.LongpexpireAt(byte[] key, long millisecondsTimestamp)Longpfadd(byte[] key, byte[]... elements)longpfcount(byte[] key)Longpfcount(byte[]... keys)Stringpfmerge(byte[] destkey, byte[]... sourcekeys)Stringping()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.Pipelinepipelined()Stringpsetex(byte[] key, long milliseconds, byte[] value)PSETEX works exactly likesetex(byte[], int, byte[])with the sole difference that the expire time is specified in milliseconds instead of seconds.voidpsubscribe(BinaryJedisPubSub jedisPubSub, byte[]... patterns)Longpttl(byte[] key)Longpublish(byte[] channel, byte[] message)Stringquit()Ask the server to silently close the connection.byte[]randomBinaryKey()Return a randomly selected key from the currently selected DB.Stringrename(byte[] oldkey, byte[] newkey)Atomically renames the key oldkey to newkey.Longrenamenx(byte[] oldkey, byte[] newkey)Rename oldkey into newkey but fails if the destination key newkey already exists.voidresetState()Stringrestore(byte[] key, int ttl, byte[] serializedValue)StringrestoreReplace(byte[] key, int ttl, byte[] serializedValue)byte[]rpop(byte[] key)Atomically return and remove the first (LPOP) or last (RPOP) element of the list.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.Longrpush(byte[] key, byte[]... strings)Add the string value to the head (LPUSH) or tail (RPUSH) of the list stored at key.Longrpushx(byte[] key, byte[]... string)Longsadd(byte[] key, byte[]... members)Add the specified member to the set value stored at key.Stringsave()Synchronously save the DB on disk.ScanResult<byte[]>scan(byte[] cursor)ScanResult<byte[]>scan(byte[] cursor, ScanParams params)Longscard(byte[] key)Return the set cardinality (number of elements).LongscriptExists(byte[] sha1)List<Long>scriptExists(byte[]... sha1)StringscriptFlush()StringscriptKill()byte[]scriptLoad(byte[] script)Set<byte[]>sdiff(byte[]... keys)Return the difference between the Set stored at key1 and all the Sets key2, ..., keyNLongsdiffstore(byte[] dstkey, byte[]... keys)This command works exactly likeSDIFFbut instead of being returned the resulting set is stored in dstkey.Stringselect(int index)Select the DB with having the specified zero-based numeric index.ObjectsendBlockingCommand(ProtocolCommand cmd, byte[]... args)ObjectsendCommand(ProtocolCommand cmd)ObjectsendCommand(ProtocolCommand cmd, byte[]... args)Stringset(byte[] key, byte[] value)Set the string value as value of the key.Stringset(byte[] key, byte[] value, SetParams params)Set the string value as value of the key.Booleansetbit(byte[] key, long offset, boolean value)Sets or clears the bit at offset in the string value stored at keyBooleansetbit(byte[] key, long offset, byte[] value)Stringsetex(byte[] key, int seconds, byte[] value)Longsetnx(byte[] key, byte[] value)SETNX works exactly likeSETwith the only difference that if the key already exists no operation is performed.Longsetrange(byte[] key, long offset, byte[] value)Stringshutdown()Synchronously save the DB on disk, then shutdown the server.Set<byte[]>sinter(byte[]... keys)Return the members of a set resulting from the intersection of all the sets hold at the specified keys.Longsinterstore(byte[] dstkey, byte[]... keys)This commanad works exactly likeSINTERbut instead of being returned the resulting set is stored as dstkey.Booleansismember(byte[] key, byte[] member)Return true if member is a member of the set stored at key, otherwise false is returned.Stringslaveof(String host, int port)Change the replication settings.StringslaveofNoOne()SLAVEOF NO ONE will stop replication, turning the server into a MASTER, but will not discard the replication.List<Object>slowlogGetBinary()List<Object>slowlogGetBinary(long entries)LongslowlogLen()StringslowlogReset()Set<byte[]>smembers(byte[] key)Return all the members (elements) of the set value stored at key.List<Boolean>smismember(byte[] key, byte[]... members)Returns whether each member is a member of the set stored at key.Longsmove(byte[] srckey, byte[] dstkey, byte[] member)Move the specified member from the set at srckey to the set at dstkey.List<byte[]>sort(byte[] key)Sort a Set or a List.Longsort(byte[] key, byte[] dstkey)Sort a Set or a List and Store the Result at dstkey.List<byte[]>sort(byte[] key, SortingParams sortingParameters)Sort a Set or a List accordingly to the specified parameters.Longsort(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.Set<byte[]>spop(byte[] key, long count)byte[]srandmember(byte[] key)Return a random element from a Set, without removing the element.List<byte[]>srandmember(byte[] key, int count)Longsrem(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)Longstrlen(byte[] key)voidsubscribe(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).Set<byte[]>sunion(byte[]... keys)Return the members of a set resulting from the union of all the sets hold at the specified keys.Longsunionstore(byte[] dstkey, byte[]... keys)This command works exactly likeSUNIONbut instead of being returned the resulting set is stored as dstkey.StringswapDB(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.voidsync()List<String>time()Longtouch(byte[] key)Longtouch(byte[]... keys)Alters the last access time of a key(s).Longttl(byte[] key)The TTL command returns the remaining time to live in seconds of a key that has anEXPIREset.Stringtype(byte[] key)Return the type of the value stored at key in form of a string.Longunlink(byte[] key)Longunlink(byte[]... keys)This command is very similar to DEL: it removes the specified keys.Stringunwatch()LongwaitReplicas(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.Stringwatch(byte[]... keys)Longxack(byte[] key, byte[] group, byte[]... ids)byte[]xadd(byte[] key, byte[] id, Map<byte[],byte[]> hash, long maxLen, boolean approximateLength)List<byte[]>xclaim(byte[] key, byte[] groupname, byte[] consumername, long minIdleTime, long newIdleTime, int retries, boolean force, byte[][] ids)Longxdel(byte[] key, byte[]... ids)StringxgroupCreate(byte[] key, byte[] consumer, byte[] id, boolean makeStream)LongxgroupDelConsumer(byte[] key, byte[] consumer, byte[] consumerName)LongxgroupDestroy(byte[] key, byte[] consumer)StringxgroupSetID(byte[] key, byte[] consumer, byte[] id)List<StreamConsumersInfo>xinfoConsumers(byte[] key, byte[] group)List<StreamGroupInfo>xinfoGroup(byte[] key)StreamInfoxinfoStream(byte[] key)Longxlen(byte[] key)List<byte[]>xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int count, byte[] consumername)List<byte[]>xrange(byte[] key, byte[] start, byte[] end, long count)List<byte[]>xread(int count, long block, Map<byte[],byte[]> streams)List<byte[]>xreadGroup(byte[] groupname, byte[] consumer, int count, long block, boolean noAck, Map<byte[],byte[]> streams)List<byte[]>xrevrange(byte[] key, byte[] end, byte[] start, int count)Longxtrim(byte[] key, long maxLen, boolean approximateLength)Longzadd(byte[] key, double score, byte[] member)Add the specified member having the specified score to the sorted set stored at key.Longzadd(byte[] key, double score, byte[] member, ZAddParams params)Longzadd(byte[] key, Map<byte[],Double> scoreMembers)Longzadd(byte[] key, Map<byte[],Double> scoreMembers, ZAddParams params)Longzcard(byte[] key)Return the sorted set cardinality (number of elements).Longzcount(byte[] key, byte[] min, byte[] max)Longzcount(byte[] key, double min, double max)Doublezincrby(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.Doublezincrby(byte[] key, double increment, byte[] member, ZIncrByParams params)Longzinterstore(byte[] dstkey, byte[]... sets)Creates a union or intersection of N sorted sets given by keys k1 through kN, and stores it at dstkey.Longzinterstore(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.Longzlexcount(byte[] key, byte[] min, byte[] max)List<Double>zmscore(byte[] key, byte[]... members)Returns the scores associated with the specified members in the sorted set stored at key.Tuplezpopmax(byte[] key)Set<Tuple>zpopmax(byte[] key, int count)Tuplezpopmin(byte[] key)Set<Tuple>zpopmin(byte[] key, int count)Set<byte[]>zrange(byte[] key, long start, long stop)Set<byte[]>zrangeByLex(byte[] key, byte[] min, byte[] max)Set<byte[]>zrangeByLex(byte[] key, byte[] min, byte[] max, int offset, int count)Set<byte[]>zrangeByScore(byte[] key, byte[] min, byte[] max)Set<byte[]>zrangeByScore(byte[] key, byte[] min, byte[] max, int offset, int count)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).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).Set<Tuple>zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max)Set<Tuple>zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max, int offset, int count)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).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).Set<Tuple>zrangeWithScores(byte[] key, long start, long stop)Longzrank(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.Longzrem(byte[] key, byte[]... members)Remove the specified member from the sorted set value stored at key.LongzremrangeByLex(byte[] key, byte[] min, byte[] max)LongzremrangeByRank(byte[] key, long start, long stop)Remove all elements in the sorted set at key with rank between start and end.LongzremrangeByScore(byte[] key, byte[] min, byte[] max)LongzremrangeByScore(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).Set<byte[]>zrevrange(byte[] key, long start, long stop)Set<byte[]>zrevrangeByLex(byte[] key, byte[] max, byte[] min)Set<byte[]>zrevrangeByLex(byte[] key, byte[] max, byte[] min, int offset, int count)Set<byte[]>zrevrangeByScore(byte[] key, byte[] max, byte[] min)Set<byte[]>zrevrangeByScore(byte[] key, byte[] max, byte[] min, int offset, int count)Set<byte[]>zrevrangeByScore(byte[] key, double max, double min)Set<byte[]>zrevrangeByScore(byte[] key, double max, double min, int offset, int count)Set<Tuple>zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min)Set<Tuple>zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min, int offset, int count)Set<Tuple>zrevrangeByScoreWithScores(byte[] key, double max, double min)Set<Tuple>zrevrangeByScoreWithScores(byte[] key, double max, double min, int offset, int count)Set<Tuple>zrevrangeWithScores(byte[] key, long start, long stop)Longzrevrank(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)Doublezscore(byte[] key, byte[] member)Return the score of the specified element of the sorted set at key.Longzunionstore(byte[] dstkey, byte[]... sets)Creates a union or intersection of N sorted sets given by keys k1 through kN, and stores it at dstkey.Longzunionstore(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.
-
-
-
Field Detail
-
client
protected Client client
-
transaction
protected Transaction transaction
-
pipeline
protected Pipeline pipeline
-
DUMMY_ARRAY
protected static final byte[][] DUMMY_ARRAY
-
-
Constructor Detail
-
BinaryJedis
public BinaryJedis()
-
BinaryJedis
public BinaryJedis(String host)
-
BinaryJedis
public BinaryJedis(HostAndPort hp)
-
BinaryJedis
public BinaryJedis(String host, int port)
-
BinaryJedis
public BinaryJedis(String host, int port, boolean ssl)
-
BinaryJedis
public BinaryJedis(String host, int port, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
-
BinaryJedis
public BinaryJedis(String host, int port, int timeout)
-
BinaryJedis
public BinaryJedis(String host, int port, int timeout, boolean ssl)
-
BinaryJedis
public BinaryJedis(String host, int port, int timeout, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
-
BinaryJedis
public BinaryJedis(String host, int port, int connectionTimeout, int soTimeout)
-
BinaryJedis
public BinaryJedis(String host, int port, int connectionTimeout, int soTimeout, int infiniteSoTimeout)
-
BinaryJedis
public BinaryJedis(String host, int port, int connectionTimeout, int soTimeout, boolean ssl)
-
BinaryJedis
public BinaryJedis(String host, int port, int connectionTimeout, int soTimeout, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
-
BinaryJedis
public BinaryJedis(String host, int port, int connectionTimeout, int soTimeout, int infiniteSoTimeout, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
-
BinaryJedis
public BinaryJedis(JedisShardInfo shardInfo)
-
BinaryJedis
public BinaryJedis(URI uri)
-
BinaryJedis
public BinaryJedis(URI uri, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
-
BinaryJedis
public BinaryJedis(URI uri, int timeout)
-
BinaryJedis
public BinaryJedis(URI uri, int timeout, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
-
BinaryJedis
public BinaryJedis(URI uri, int connectionTimeout, int soTimeout)
-
BinaryJedis
public BinaryJedis(URI uri, int connectionTimeout, int soTimeout, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
-
BinaryJedis
public BinaryJedis(URI uri, int connectionTimeout, int soTimeout, int infiniteSoTimeout, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
-
BinaryJedis
public BinaryJedis(JedisSocketFactory jedisSocketFactory)
-
-
Method Detail
-
ping
public String ping()
Description copied from interface:BasicCommandsThis command is often used to test if a connection is still alive, or to measure latency.- Specified by:
pingin interfaceBasicCommands- Returns:
- PONG
-
ping
public byte[] ping(byte[] message)
Works same as ping() but returns argument message instead of PONG.- Parameters:
message-- Returns:
- message
-
set
public String set(byte[] key, byte[] value)
Set the string value as value of the key. The string can't be longer than 1073741824 bytes (1 GB).Time complexity: O(1)
- Specified by:
setin interfaceBinaryJedisCommands- Parameters:
key-value-- Returns:
- Status code reply
-
set
public String set(byte[] key, byte[] value, SetParams params)
Set the string value as value of the key. The string can't be longer than 1073741824 bytes (1 GB).- Specified by:
setin interfaceBinaryJedisCommands- Parameters:
key-value-params-- Returns:
- Status code reply
-
get
public byte[] get(byte[] key)
Get the value of the specified key. If the key does not exist the special value 'nil' is returned. If the value stored at key is not a string an error is returned because GET can only handle string values.Time complexity: O(1)
- Specified by:
getin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- Bulk reply
-
quit
public String quit()
Ask the server to silently close the connection.- Specified by:
quitin interfaceBasicCommands- Returns:
- OK
-
exists
public Long exists(byte[]... keys)
Test if the specified keys exist. The command returns the number of keys exist. Time complexity: O(N)- Specified by:
existsin interfaceMultiKeyBinaryCommands- Parameters:
keys-- Returns:
- Integer reply, specifically: an integer greater than 0 if one or more keys exist, 0 if none of the specified keys exist.
-
exists
public Boolean exists(byte[] key)
Test if the specified key exists. The command returns true if the key exists, otherwise false is returned. Note that even keys set with an empty string as value will return true. Time complexity: O(1)- Specified by:
existsin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- Boolean reply, true if the key exists, otherwise false
-
del
public Long del(byte[]... keys)
Remove the specified keys. If a given key does not exist no operation is performed for this key. The command returns the number of keys removed. Time complexity: O(1)- Specified by:
delin interfaceMultiKeyBinaryCommands- Parameters:
keys-- Returns:
- Integer reply, specifically: an integer greater than 0 if one or more keys were removed 0 if none of the specified key existed
-
del
public Long del(byte[] key)
- Specified by:
delin interfaceBinaryJedisCommands
-
unlink
public Long unlink(byte[]... keys)
This command is very similar to DEL: it removes the specified keys. Just like DEL a key is ignored if it does not exist. However the command performs the actual memory reclaiming in a different thread, so it is not blocking, while DEL is. This is where the command name comes from: the command just unlinks the keys from the keyspace. The actual removal will happen later asynchronously.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.
- Specified by:
unlinkin interfaceMultiKeyBinaryCommands- Parameters:
keys-- Returns:
- Integer reply: The number of keys that were unlinked
-
unlink
public Long unlink(byte[] key)
- Specified by:
unlinkin interfaceBinaryJedisCommands
-
type
public String type(byte[] key)
Return the type of the value stored at key in form of a string. The type can be one of "none", "string", "list", "set". "none" is returned if the key does not exist. Time complexity: O(1)- Specified by:
typein interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- Status code reply, specifically: "none" if the key does not exist "string" if the key contains a String value "list" if the key contains a List value "set" if the key contains a Set value "zset" if the key contains a Sorted Set value "hash" if the key contains a Hash value
-
flushDB
public String flushDB()
Delete all the keys of the currently selected DB. This command never fails.- Specified by:
flushDBin interfaceBasicCommands- Returns:
- Status code reply
-
keys
public Set<byte[]> keys(byte[] pattern)
Returns all the keys matching the glob-style pattern as space separated strings. For example if you have in the database the keys "foo" and "foobar" the command "KEYS foo*" will return "foo foobar".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:
- h?llo will match hello hallo hhllo
- h*llo will match hllo heeeello
- h[ae]llo will match hello and hallo, but not hillo
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)
- Specified by:
keysin interfaceMultiKeyBinaryCommands- Parameters:
pattern-- Returns:
- Multi bulk reply
-
randomBinaryKey
public byte[] randomBinaryKey()
Return a randomly selected key from the currently selected DB.Time complexity: O(1)
- Specified by:
randomBinaryKeyin interfaceMultiKeyBinaryCommands- Returns:
- Single line reply, specifically the randomly selected key or an empty string is the database is empty
-
rename
public String rename(byte[] oldkey, byte[] newkey)
Atomically renames the key oldkey to newkey. If the source and destination name are the same an error is returned. If newkey already exists it is overwritten.Time complexity: O(1)
- Specified by:
renamein interfaceMultiKeyBinaryCommands- Parameters:
oldkey-newkey-- Returns:
- Status code reply
-
renamenx
public Long renamenx(byte[] oldkey, byte[] newkey)
Rename oldkey into newkey but fails if the destination key newkey already exists.Time complexity: O(1)
- Specified by:
renamenxin interfaceMultiKeyBinaryCommands- Parameters:
oldkey-newkey-- Returns:
- Integer reply, specifically: 1 if the key was renamed 0 if the target key already exist
-
dbSize
public Long dbSize()
Return the number of keys in the currently selected database.- Specified by:
dbSizein interfaceBasicCommands- Returns:
- Integer reply
-
expire
public Long expire(byte[] key, int seconds)
Set a timeout on the specified key. After the timeout the key will be automatically deleted by the server. A key with an associated timeout is said to be volatile in Redis terminology.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
PERSISTcommand.Time complexity: O(1)
- Specified by:
expirein interfaceBinaryJedisCommands- Parameters:
key-seconds-- Returns:
- Integer reply, specifically: 1: the timeout was set. 0: the timeout was not set since the key already has an associated timeout (this may happen only in Redis versions < 2.1.3, Redis >= 2.1.3 will happily update the timeout), or the key does not exist.
- See Also:
- Expire Command
-
expireAt
public Long expireAt(byte[] key, long unixTime)
EXPIREAT works exactly likeEXPIREbut 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
PERSISTcommand.Time complexity: O(1)
- Specified by:
expireAtin interfaceBinaryJedisCommands- Parameters:
key-unixTime-- Returns:
- Integer reply, specifically: 1: the timeout was set. 0: the timeout was not set since the key already has an associated timeout (this may happen only in Redis versions < 2.1.3, Redis >= 2.1.3 will happily update the timeout), or the key does not exist.
- See Also:
- Expire Command
-
ttl
public Long ttl(byte[] key)
The TTL command returns the remaining time to live in seconds of a key that has anEXPIREset. This introspection capability allows a Redis client to check how many seconds a given key will continue to be part of the dataset.- Specified by:
ttlin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- Integer reply, returns the remaining time to live in seconds of a key that has an EXPIRE. If the Key does not exists or does not have an associated expire, -1 is returned.
-
touch
public Long touch(byte[]... keys)
Alters the last access time of a key(s). A key is ignored if it does not exist. Time complexity: O(N) where N is the number of keys that will be touched.- Specified by:
touchin interfaceMultiKeyBinaryCommands- Parameters:
keys-- Returns:
- Integer reply: The number of keys that were touched.
-
touch
public Long touch(byte[] key)
- Specified by:
touchin interfaceBinaryJedisCommands
-
select
public String select(int index)
Select the DB with having the specified zero-based numeric index. For default every new client connection is automatically selected to DB 0.- Specified by:
selectin interfaceBasicCommands- Parameters:
index-- Returns:
- Status code reply
-
swapDB
public String swapDB(int index1, int index2)
Description copied from interface:BasicCommandsThis 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.- Specified by:
swapDBin interfaceBasicCommands- Returns:
- Simple string reply: OK if SWAPDB was executed correctly.
-
move
public Long move(byte[] key, int dbIndex)
Move the specified key from the currently selected DB to the specified destination DB. Note that this command returns 1 only if the key was successfully moved, and 0 if the target key was already there or if the source key was not found at all, so it is possible to use MOVE as a locking primitive.- Specified by:
movein interfaceBinaryJedisCommands- Parameters:
key-dbIndex-- Returns:
- Integer reply, specifically: 1 if the key was moved 0 if the key was not moved because already present on the target DB or was not found in the current DB.
-
flushAll
public String flushAll()
Delete all the keys of all the existing databases, not just the currently selected one. This command never fails.- Specified by:
flushAllin interfaceBasicCommands- Returns:
- Status code reply
-
getSet
public byte[] getSet(byte[] key, byte[] value)GETSET is an atomic set this value and return the old value command. Set key to the string value and return the old value stored at key. The string can't be longer than 1073741824 bytes (1 GB).Time complexity: O(1)
- Specified by:
getSetin interfaceBinaryJedisCommands- Parameters:
key-value-- Returns:
- Bulk reply
-
mget
public List<byte[]> mget(byte[]... keys)
Get the values of all the specified keys. If one or more keys don't exist or is not of type String, a 'nil' value is returned instead of the value of the specified key, but the operation never fails.Time complexity: O(1) for every key
- Specified by:
mgetin interfaceMultiKeyBinaryCommands- Parameters:
keys-- Returns:
- Multi bulk reply
-
setnx
public Long setnx(byte[] key, byte[] value)
SETNX works exactly likeSETwith the only difference that if the key already exists no operation is performed. SETNX actually means "SET if Not eXists".Time complexity: O(1)
- Specified by:
setnxin interfaceBinaryJedisCommands- Parameters:
key-value-- Returns:
- Integer reply, specifically: 1 if the key was set 0 if the key was not set
-
setex
public String setex(byte[] key, int seconds, byte[] value)
The command is exactly equivalent to the following group of commands:SET+EXPIRE. The operation is atomic.Time complexity: O(1)
- Specified by:
setexin interfaceBinaryJedisCommands- Parameters:
key-seconds-value-- Returns:
- Status code reply
-
mset
public String mset(byte[]... keysvalues)
Set the the respective keys to the respective values. MSET will replace old values with new values, whileMSETNXwill 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.
- Specified by:
msetin interfaceMultiKeyBinaryCommands- Parameters:
keysvalues-- Returns:
- Status code reply Basically +OK as MSET can't fail
- See Also:
msetnx(byte[]...)
-
msetnx
public Long msetnx(byte[]... keysvalues)
Set the the respective keys to the respective values.MSETwill 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.
- Specified by:
msetnxin interfaceMultiKeyBinaryCommands- Parameters:
keysvalues-- Returns:
- Integer reply, specifically: 1 if the all the keys were set 0 if no key was set (at least one key already existed)
- See Also:
mset(byte[]...)
-
decrBy
public Long decrBy(byte[] key, long decrement)
DECRBY work just likeINCRbut 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)
- Specified by:
decrByin interfaceBinaryJedisCommands- Parameters:
key-decrement-- Returns:
- Integer reply, this commands will reply with the new value of key after the increment.
- See Also:
incr(byte[]),decr(byte[]),incrBy(byte[], long)
-
decr
public Long decr(byte[] key)
Decrement the number stored at key by one. If the key does not exist or contains a value of a wrong type, set the key to the value of "0" before to perform the decrement operation.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)
- Specified by:
decrin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- Integer reply, this commands will reply with the new value of key after the increment.
- See Also:
incr(byte[]),incrBy(byte[], long),decrBy(byte[], long)
-
incrBy
public Long incrBy(byte[] key, long increment)
INCRBY work just likeINCRbut 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)
- Specified by:
incrByin interfaceBinaryJedisCommands- Parameters:
key-increment-- Returns:
- Integer reply, this commands will reply with the new value of key after the increment.
- See Also:
incr(byte[]),decr(byte[]),decrBy(byte[], long)
-
incrByFloat
public Double incrByFloat(byte[] key, double increment)
INCRBYFLOAT work just likeincrBy(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)
- Specified by:
incrByFloatin interfaceBinaryJedisCommands- Parameters:
key- the key to incrementincrement- the value to increment by- Returns:
- Integer reply, this commands will reply with the new value of key after the increment.
- See Also:
incr(byte[]),decr(byte[]),decrBy(byte[], long)
-
incr
public Long incr(byte[] key)
Increment the number stored at key by one. If the key does not exist or contains a value of a wrong type, set the key to the value of "0" before to perform the increment operation.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)
- Specified by:
incrin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- Integer reply, this commands will reply with the new value of key after the increment.
- See Also:
incrBy(byte[], long),decr(byte[]),decrBy(byte[], long)
-
append
public 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. If the key does not exist it is created and set as an empty string, so APPEND will be very similar to SET in this special case.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.
- Specified by:
appendin interfaceBinaryJedisCommands- Parameters:
key-value-- Returns:
- Integer reply, specifically the total length of the string after the append operation.
-
substr
public byte[] substr(byte[] key, int start, int end)Return a subset of the string from offset start to offset end (both offsets are inclusive). Negative offsets can be used in order to provide an offset starting from the end of the string. So -1 means the last char, -2 the penultimate and so forth.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.
- Specified by:
substrin interfaceBinaryJedisCommands- Parameters:
key-start-end-- Returns:
- Bulk reply
-
hset
public Long hset(byte[] key, byte[] field, byte[] value)
Set the specified hash field to the specified value.If key does not exist, a new key holding a hash is created.
Time complexity: O(1)
- Specified by:
hsetin interfaceBinaryJedisCommands- Parameters:
key-field-value-- Returns:
- If the field already exists, and the HSET just produced an update of the value, 0 is returned, otherwise if a new field is created 1 is returned.
-
hset
public Long hset(byte[] key, Map<byte[],byte[]> hash)
- Specified by:
hsetin interfaceBinaryJedisCommands
-
hget
public byte[] hget(byte[] key, byte[] field)If key holds a hash, retrieve the value associated to the specified field.If the field is not found or the key does not exist, a special 'nil' value is returned.
Time complexity: O(1)
- Specified by:
hgetin interfaceBinaryJedisCommands- Parameters:
key-field-- Returns:
- Bulk reply
-
hsetnx
public Long hsetnx(byte[] key, byte[] field, byte[] value)
Set the specified hash field to the specified value if the field not exists. Time complexity: O(1)- Specified by:
hsetnxin interfaceBinaryJedisCommands- Parameters:
key-field-value-- Returns:
- If the field already exists, 0 is returned, otherwise if a new field is created 1 is returned.
-
hmset
public String hmset(byte[] key, Map<byte[],byte[]> hash)
Set the respective fields to the respective values. HMSET replaces old values with new values.If key does not exist, a new key holding a hash is created.
Time complexity: O(N) (with N being the number of fields)
- Specified by:
hmsetin interfaceBinaryJedisCommands- Parameters:
key-hash-- Returns:
- Always OK because HMSET can't fail
-
hmget
public List<byte[]> hmget(byte[] key, byte[]... fields)
Retrieve the values associated to the specified 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)
- Specified by:
hmgetin interfaceBinaryJedisCommands- Parameters:
key-fields-- Returns:
- Multi Bulk Reply specifically a list of all the values associated with the specified fields, in the same order of the request.
-
hincrBy
public Long hincrBy(byte[] key, byte[] field, long value)
Increment the number stored at field in the hash at key by value. If key does not exist, a new key holding a hash is created. If field does not exist or holds a string, the value is set to 0 before applying the operation. Since the value argument is signed you can use this command to perform both increments and decrements.The range of values supported by HINCRBY is limited to 64 bit signed integers.
Time complexity: O(1)
- Specified by:
hincrByin interfaceBinaryJedisCommands- Parameters:
key-field-value-- Returns:
- Integer reply The new value at field after the increment operation.
-
hincrByFloat
public 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. If key does not exist, a new key holding a hash is created. If field does not exist or holds a string, the value is set to 0 before applying the operation. Since the value argument is signed you can use this command to perform both increments and decrements.The range of values supported by HINCRBYFLOAT is limited to double precision floating point values.
Time complexity: O(1)
- Specified by:
hincrByFloatin interfaceBinaryJedisCommands- Parameters:
key-field-value-- Returns:
- Double precision floating point reply The new value at field after the increment operation.
-
hexists
public Boolean hexists(byte[] key, byte[] field)
Test for existence of a specified field in a hash. Time complexity: O(1)- Specified by:
hexistsin interfaceBinaryJedisCommands- Parameters:
key-field-- Returns:
- Return true if the hash stored at key contains the specified field. Return false if the key is not found or the field is not present.
-
hdel
public Long hdel(byte[] key, byte[]... fields)
Remove the specified field from an hash stored at key.Time complexity: O(1)
- Specified by:
hdelin interfaceBinaryJedisCommands- Parameters:
key-fields-- Returns:
- If the field was present in the hash it is deleted and 1 is returned, otherwise 0 is returned and no operation is performed.
-
hlen
public Long hlen(byte[] key)
Return the number of items in a hash.Time complexity: O(1)
- Specified by:
hlenin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- The number of entries (fields) contained in the hash stored at key. If the specified key does not exist, 0 is returned assuming an empty hash.
-
hkeys
public Set<byte[]> hkeys(byte[] key)
Return all the fields in a hash.Time complexity: O(N), where N is the total number of entries
- Specified by:
hkeysin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- All the fields names contained into a hash.
-
hvals
public List<byte[]> hvals(byte[] key)
Return all the values in a hash.Time complexity: O(N), where N is the total number of entries
- Specified by:
hvalsin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- All the fields values contained into a hash.
-
hgetAll
public Map<byte[],byte[]> hgetAll(byte[] key)
Return all the fields and associated values in a hash.Time complexity: O(N), where N is the total number of entries
- Specified by:
hgetAllin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- All the fields and values contained into a hash.
-
rpush
public Long rpush(byte[] key, byte[]... strings)
Add the string value to the head (LPUSH) or tail (RPUSH) of the list stored at key. If the key does not exist an empty list is created just before the append operation. If the key exists but is not a List an error is returned.Time complexity: O(1)
- Specified by:
rpushin interfaceBinaryJedisCommands- Parameters:
key-strings-- Returns:
- Integer reply, specifically, the number of elements inside the list after the push operation.
- See Also:
rpush(byte[], byte[]...)
-
lpush
public Long lpush(byte[] key, byte[]... strings)
Add the string value to the head (LPUSH) or tail (RPUSH) of the list stored at key. If the key does not exist an empty list is created just before the append operation. If the key exists but is not a List an error is returned.Time complexity: O(1)
- Specified by:
lpushin interfaceBinaryJedisCommands- Parameters:
key-strings-- Returns:
- Integer reply, specifically, the number of elements inside the list after the push operation.
- See Also:
rpush(byte[], byte[]...)
-
llen
public Long llen(byte[] key)
Return the length of the list stored at the specified key. If the key does not exist zero is returned (the same behaviour as for empty lists). If the value stored at key is not a list an error is returned.Time complexity: O(1)
- Specified by:
llenin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- The length of the list.
-
lrange
public List<byte[]> lrange(byte[] key, long start, long stop)
Return the specified elements of the list stored at the specified key. Start and end are zero-based indexes. 0 is the first element of the list (the list head), 1 the next element and so on.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)
- Specified by:
lrangein interfaceBinaryJedisCommands- Parameters:
key-start-stop-- Returns:
- Multi bulk reply, specifically a list of elements in the specified range.
-
ltrim
public String ltrim(byte[] key, long start, long stop)
Trim an existing list so that it will contain only the specified range of elements specified. Start and end are zero-based indexes. 0 is the first element of the list (the list head), 1 the next element and so on.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)
- Specified by:
ltrimin interfaceBinaryJedisCommands- Parameters:
key-start-stop-- Returns:
- Status code reply
-
lindex
public 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. Negative indexes are supported, for example -1 is the last element, -2 the penultimate and so on.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)
- Specified by:
lindexin interfaceBinaryJedisCommands- Parameters:
key-index-- Returns:
- Bulk reply, specifically the requested element
-
lset
public String lset(byte[] key, long index, byte[] value)
Set a new value as the element at index position of the List at key.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).
- Specified by:
lsetin interfaceBinaryJedisCommands- Parameters:
key-index-value-- Returns:
- Status code reply
- See Also:
lindex(byte[], long)
-
lrem
public Long lrem(byte[] key, long count, byte[] value)
Remove the first count occurrences of the value element from the list. If count is zero all the elements are removed. If count is negative elements are removed from tail to head, instead to go from head to tail that is the normal behaviour. So for example LREM with count -2 and hello as value to remove against the list (a,b,c,hello,x,hello,hello) will leave the list (a,b,c,hello,x). The number of removed elements is returned as an integer, see below for more information about the returned value. Note that non existing keys are considered like empty lists by LREM, so LREM against non existing keys will always return 0.Time complexity: O(N) (with N being the length of the list)
- Specified by:
lremin interfaceBinaryJedisCommands- Parameters:
key-count-value-- Returns:
- Integer Reply, specifically: The number of removed elements if the operation succeeded
-
lpop
public byte[] lpop(byte[] key)
Atomically return and remove the first (LPOP) or last (RPOP) element of the list. For example if the list contains the elements "a","b","c" LPOP will return "a" and the list will become "b","c".If the key does not exist or the list is already empty the special value 'nil' is returned.
- Specified by:
lpopin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- Bulk reply
- See Also:
rpop(byte[])
-
lpop
public List<byte[]> lpop(byte[] key, int count)
- Specified by:
lpopin interfaceBinaryJedisCommands
-
lpos
public Long lpos(byte[] key, byte[] element)
Returns the index of the first matching element inside a redis list. If the element is found, its index (the zero-based position in the list) is returned. Otherwise, if no match is found, 'nil' is returned.Time complexity: O(N) where N is the number of elements in the list
- Specified by:
lposin interfaceBinaryJedisCommands- Parameters:
key-element-- Returns:
- Integer Reply, specifically: The index of first matching element in the list. Value will be 'nil' when the element is not present in the list.
- See Also:
lpos(byte[], byte[])
-
lpos
public Long lpos(byte[] key, byte[] element, LPosParams params)
In case there are multiple matches Rank option specifies the "rank" of the element to return. A rank of 1 returns the first match, 2 to return the second match, and so forth. If list `foo` has elements ("a","b","c","1","2","3","c","c"), The function call to get the index of second occurrence of "c" will be as follows lpos("foo","c", LPosParams.lPosParams().rank(2)).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)).
- Specified by:
lposin interfaceBinaryJedisCommands- Parameters:
key-element-params-- Returns:
- Integer Reply
- See Also:
lpos(byte[], byte[], LPosParams)
-
lpos
public List<Long> lpos(byte[] key, byte[] element, LPosParams params, long count)
Count will return list of position of all the first N matching elements. It is possible to specify 0 as the number of matches, as a way to tell the command we want all the matches found returned as an array of indexes. When count is used and no match is found, an empty list is returned.Time complexity: O(N) where N is the number of elements in the list
- Specified by:
lposin interfaceBinaryJedisCommands- Parameters:
key-element-count-- Returns:
- Returns value will be a list containing position of the matching elements inside the list.
- See Also:
lpos(byte[], byte[], LPosParams, long)
-
rpop
public byte[] rpop(byte[] key)
Atomically return and remove the first (LPOP) or last (RPOP) element of the list. For example if the list contains the elements "a","b","c" LPOP will return "a" and the list will become "b","c".If the key does not exist or the list is already empty the special value 'nil' is returned.
- Specified by:
rpopin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- Bulk reply
- See Also:
lpop(byte[])
-
rpop
public List<byte[]> rpop(byte[] key, int count)
- Specified by:
rpopin interfaceBinaryJedisCommands
-
rpoplpush
public 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. For example if the source list contains the elements "a","b","c" and the destination list contains the elements "foo","bar" after an RPOPLPUSH command the content of the two lists will be "a","b" and "c","foo","bar".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)
- Specified by:
rpoplpushin interfaceMultiKeyBinaryCommands- Parameters:
srckey-dstkey-- Returns:
- Bulk reply
-
sadd
public Long sadd(byte[] key, byte[]... members)
Add the specified member to the set value stored at key. If member is already a member of the set no operation is performed. If key does not exist a new set with the specified member as sole member is created. If the key exists but does not hold a set value an error is returned.Time complexity O(1)
- Specified by:
saddin interfaceBinaryJedisCommands- Parameters:
key-members-- Returns:
- Integer reply, specifically: 1 if the new element was added 0 if the element was already a member of the set
-
smembers
public Set<byte[]> smembers(byte[] key)
Return all the members (elements) of the set value stored at key. This is just syntax glue forsinter(byte[]...)SINTER}.Time complexity O(N)
- Specified by:
smembersin interfaceBinaryJedisCommands- Parameters:
key- the key of the set- Returns:
- Multi bulk reply
-
srem
public Long srem(byte[] key, byte[]... member)
Remove the specified member from the set value stored at key. If member was not a member of the set no operation is performed. If key does not hold a set value an error is returned.Time complexity O(1)
- Specified by:
sremin interfaceBinaryJedisCommands- Parameters:
key- the key of the setmember- the set member to remove- Returns:
- Integer reply, specifically: 1 if the new element was removed 0 if the new element was not a member of the set
-
spop
public byte[] spop(byte[] key)
Remove a random element from a Set returning it as return value. If the Set is empty or the key does not exist, a nil object is returned.The
srandmember(byte[])command does a similar work but the returned element is not removed from the Set.Time complexity O(1)
- Specified by:
spopin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- Bulk reply
-
spop
public Set<byte[]> spop(byte[] key, long count)
- Specified by:
spopin interfaceBinaryJedisCommands
-
smove
public Long smove(byte[] srckey, byte[] dstkey, byte[] member)
Move the specified member from the set at srckey to the set at dstkey. This operation is atomic, in every given moment the element will appear to be in the source or destination set for accessing clients.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)
- Specified by:
smovein interfaceMultiKeyBinaryCommands- Parameters:
srckey-dstkey-member-- Returns:
- Integer reply, specifically: 1 if the element was moved 0 if the element was not found on the first set and no operation was performed
-
scard
public Long scard(byte[] key)
Return the set cardinality (number of elements). If the key does not exist 0 is returned, like for empty sets.- Specified by:
scardin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- Integer reply, specifically: the cardinality (number of elements) of the set as an integer.
-
sismember
public Boolean sismember(byte[] key, byte[] member)
Return true if member is a member of the set stored at key, otherwise false is returned.Time complexity O(1)
- Specified by:
sismemberin interfaceBinaryJedisCommands- Parameters:
key-member-- Returns:
- Boolean reply, specifically: true if the element is a member of the set false if the element is not a member of the set OR if the key does not exist
-
smismember
public List<Boolean> smismember(byte[] key, byte[]... members)
Returns whether each member is a member of the set stored at key.Time complexity O(N) where N is the number of elements being checked for membership
- Specified by:
smismemberin interfaceBinaryJedisCommands- Parameters:
key-members-- Returns:
- List representing the membership of the given elements, in the same order as they are requested.
-
sinter
public Set<byte[]> sinter(byte[]... keys)
Return the members of a set resulting from the intersection of all the sets hold at the specified keys. Like inlrange(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 asSMEMBERS. 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
- Specified by:
sinterin interfaceMultiKeyBinaryCommands- Parameters:
keys-- Returns:
- Multi bulk reply, specifically the list of common elements.
-
sinterstore
public Long sinterstore(byte[] dstkey, byte[]... keys)
This commanad works exactly likeSINTERbut 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
- Specified by:
sinterstorein interfaceMultiKeyBinaryCommands- Parameters:
dstkey-keys-- Returns:
- Status code reply
-
sunion
public Set<byte[]> sunion(byte[]... keys)
Return the members of a set resulting from the union of all the sets hold at the specified keys. Like inlrange(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 asSMEMBERS.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
- Specified by:
sunionin interfaceMultiKeyBinaryCommands- Parameters:
keys-- Returns:
- Multi bulk reply, specifically the list of common elements.
-
sunionstore
public Long sunionstore(byte[] dstkey, byte[]... keys)
This command works exactly likeSUNIONbut 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
- Specified by:
sunionstorein interfaceMultiKeyBinaryCommands- Parameters:
dstkey-keys-- Returns:
- Status code reply
-
sdiff
public Set<byte[]> sdiff(byte[]... keys)
Return the difference between the Set stored at key1 and all the Sets key2, ..., keyNExample:
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
- Specified by:
sdiffin interfaceMultiKeyBinaryCommands- Parameters:
keys-- Returns:
- Return the members of a set resulting from the difference between the first set provided and all the successive sets.
-
sdiffstore
public Long sdiffstore(byte[] dstkey, byte[]... keys)
This command works exactly likeSDIFFbut instead of being returned the resulting set is stored in dstkey.- Specified by:
sdiffstorein interfaceMultiKeyBinaryCommands- Parameters:
dstkey-keys-- Returns:
- Status code reply
-
srandmember
public byte[] srandmember(byte[] key)
Return a random element from a Set, without removing the element. If the Set is empty or the key does not exist, a nil object is returned.The SPOP command does a similar work but the returned element is popped (removed) from the Set.
Time complexity O(1)
- Specified by:
srandmemberin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- Bulk reply
-
srandmember
public List<byte[]> srandmember(byte[] key, int count)
- Specified by:
srandmemberin interfaceBinaryJedisCommands
-
zadd
public Long zadd(byte[] key, double score, byte[] member)
Add the specified member having the specified score to the sorted set stored at key. If member is already a member of the sorted set the score is updated, and the element reinserted in the right position to ensure sorting. If key does not exist a new sorted set with the specified member as sole member is created. If the key exists but does not hold a sorted set value an error is returned.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
- Specified by:
zaddin interfaceBinaryJedisCommands- Parameters:
key-score-member-- Returns:
- Integer reply, specifically: 1 if the new element was added 0 if the element was already a member of the sorted set and the score was updated
-
zadd
public Long zadd(byte[] key, double score, byte[] member, ZAddParams params)
- Specified by:
zaddin interfaceBinaryJedisCommands
-
zadd
public Long zadd(byte[] key, Map<byte[],Double> scoreMembers)
- Specified by:
zaddin interfaceBinaryJedisCommands
-
zadd
public Long zadd(byte[] key, Map<byte[],Double> scoreMembers, ZAddParams params)
- Specified by:
zaddin interfaceBinaryJedisCommands
-
zrange
public Set<byte[]> zrange(byte[] key, long start, long stop)
- Specified by:
zrangein interfaceBinaryJedisCommands
-
zrem
public Long zrem(byte[] key, byte[]... members)
Remove the specified member from the sorted set value stored at key. If member was not a member of the set no operation is performed. If key does not not hold a set value an error is returned.Time complexity O(log(N)) with N being the number of elements in the sorted set
- Specified by:
zremin interfaceBinaryJedisCommands- Parameters:
key-members-- Returns:
- Integer reply, specifically: 1 if the new element was removed 0 if the new element was not a member of the set
-
zincrby
public 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. If member does not already exist in the sorted set it is added with increment as score (that is, like if the previous score was virtually zero). If key does not exist a new sorted set with the specified member as sole member is created. If the key exists but does not hold a sorted set value an error is returned.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
- Specified by:
zincrbyin interfaceBinaryJedisCommands- Parameters:
key-increment-member-- Returns:
- The new score
-
zincrby
public Double zincrby(byte[] key, double increment, byte[] member, ZIncrByParams params)
- Specified by:
zincrbyin interfaceBinaryJedisCommands
-
zrank
public 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.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))
- Specified by:
zrankin interfaceBinaryJedisCommands- Parameters:
key-member-- Returns:
- Integer reply or a nil bulk reply, specifically: the rank of the element as an integer reply if the element exists. A nil bulk reply if there is no such element.
- See Also:
zrevrank(byte[], byte[])
-
zrevrank
public 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.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))
- Specified by:
zrevrankin interfaceBinaryJedisCommands- Parameters:
key-member-- Returns:
- Integer reply or a nil bulk reply, specifically: the rank of the element as an integer reply if the element exists. A nil bulk reply if there is no such element.
- See Also:
zrank(byte[], byte[])
-
zrevrange
public Set<byte[]> zrevrange(byte[] key, long start, long stop)
- Specified by:
zrevrangein interfaceBinaryJedisCommands
-
zrangeWithScores
public Set<Tuple> zrangeWithScores(byte[] key, long start, long stop)
- Specified by:
zrangeWithScoresin interfaceBinaryJedisCommands
-
zrevrangeWithScores
public Set<Tuple> zrevrangeWithScores(byte[] key, long start, long stop)
- Specified by:
zrevrangeWithScoresin interfaceBinaryJedisCommands
-
zcard
public Long zcard(byte[] key)
Return the sorted set cardinality (number of elements). If the key does not exist 0 is returned, like for empty sorted sets.Time complexity O(1)
- Specified by:
zcardin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- the cardinality (number of elements) of the set as an integer.
-
zscore
public Double zscore(byte[] key, byte[] member)
Return the score of the specified element of the sorted set at key. If the specified element does not exist in the sorted set, or the key does not exist at all, a special 'nil' value is returned.Time complexity: O(1)
- Specified by:
zscorein interfaceBinaryJedisCommands- Parameters:
key-member-- Returns:
- the score
-
zmscore
public List<Double> zmscore(byte[] key, byte[]... members)
Returns the scores associated with the specified members in the sorted set stored at key. For every member that does not exist in the sorted set, a nil value is returned.Time complexity: O(N) where N is the number of members being requested.
- Specified by:
zmscorein interfaceBinaryJedisCommands- Parameters:
key-members-- Returns:
- the scores
-
zpopmax
public Tuple zpopmax(byte[] key)
- Specified by:
zpopmaxin interfaceBinaryJedisCommands
-
zpopmax
public Set<Tuple> zpopmax(byte[] key, int count)
- Specified by:
zpopmaxin interfaceBinaryJedisCommands
-
zpopmin
public Tuple zpopmin(byte[] key)
- Specified by:
zpopminin interfaceBinaryJedisCommands
-
zpopmin
public Set<Tuple> zpopmin(byte[] key, int count)
- Specified by:
zpopminin interfaceBinaryJedisCommands
-
multi
public Transaction multi()
-
checkIsInMultiOrPipeline
protected void checkIsInMultiOrPipeline()
-
connect
public void connect()
-
disconnect
public void disconnect()
-
resetState
public void resetState()
-
watch
public String watch(byte[]... keys)
- Specified by:
watchin interfaceMultiKeyBinaryCommands
-
unwatch
public String unwatch()
- Specified by:
unwatchin interfaceMultiKeyBinaryCommands
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
sort
public List<byte[]> sort(byte[] key)
Sort a Set or a List.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.
- Specified by:
sortin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- Assuming the Set/List at key contains a list of numbers, the return value will be the list of numbers ordered from the smallest to the biggest number.
- See Also:
sort(byte[], byte[]),sort(byte[], SortingParams),sort(byte[], SortingParams, byte[])
-
sort
public List<byte[]> sort(byte[] key, SortingParams sortingParameters)
Sort a Set or a List accordingly to the specified parameters.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 = 7
Sort 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]
- Specified by:
sortin interfaceBinaryJedisCommands- Parameters:
key-sortingParameters-- Returns:
- a list of sorted elements.
- See Also:
sort(byte[]),sort(byte[], SortingParams, byte[])
-
blpop
public List<byte[]> blpop(int timeout, byte[]... keys)
BLPOP (and BRPOP) is a blocking list pop primitive. You can see this commands as blocking versions of LPOP and RPOP able to block if the specified keys don't exist or contain empty lists.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)
- Specified by:
blpopin interfaceMultiKeyBinaryCommands- Parameters:
timeout-keys-- Returns:
- BLPOP returns a two-elements array via a multi bulk reply in order to return both the
unblocking key and the popped value.
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.
- See Also:
brpop(int, byte[]...)
-
sort
public 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.- Specified by:
sortin interfaceMultiKeyBinaryCommands- Parameters:
key-sortingParameters-dstkey-- Returns:
- The number of elements of the list at dstkey.
- See Also:
sort(byte[], SortingParams),sort(byte[]),sort(byte[], byte[])
-
sort
public Long sort(byte[] key, byte[] dstkey)
Sort a Set or a List and Store the Result at 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.
- Specified by:
sortin interfaceMultiKeyBinaryCommands- Parameters:
key-dstkey-- Returns:
- The number of elements of the list at dstkey.
- See Also:
sort(byte[]),sort(byte[], SortingParams),sort(byte[], SortingParams, byte[])
-
brpop
public List<byte[]> brpop(int timeout, byte[]... keys)
BLPOP (and BRPOP) is a blocking list pop primitive. You can see this commands as blocking versions of LPOP and RPOP able to block if the specified keys don't exist or contain empty lists.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)
- Specified by:
brpopin interfaceMultiKeyBinaryCommands- Parameters:
timeout-keys-- Returns:
- BLPOP returns a two-elements array via a multi bulk reply in order to return both the
unblocking key and the popped value.
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.
- See Also:
blpop(int, byte[]...)
-
blpop
public List<byte[]> blpop(byte[]... args)
- Specified by:
blpopin interfaceMultiKeyBinaryCommands
-
brpop
public List<byte[]> brpop(byte[]... args)
- Specified by:
brpopin interfaceMultiKeyBinaryCommands
-
auth
public String auth(String password)
Request for authentication in a password protected Redis server. A Redis server can be instructed to require a password before to allow clients to issue commands. This is done using the requirepass directive in the Redis configuration file. If the password given by the client is correct the server replies with an OK status code reply and starts accepting commands from the client. Otherwise an error is returned and the clients needs to try a new password. Note that for the high performance nature of Redis it is possible to try a lot of passwords in parallel in very short time, so make sure to generate a strong and very long password so that this attack is infeasible.- Specified by:
authin interfaceBasicCommands- Parameters:
password-- Returns:
- Status code reply
-
auth
public String auth(String user, String password)
Request for authentication with a Redis Server that is using ACL where user are authenticated with username and password. See https://redis.io/topics/acl- Specified by:
authin interfaceBasicCommands- Parameters:
user-password-- Returns:
-
pipelined
public Pipeline pipelined()
-
zcount
public Long zcount(byte[] key, double min, double max)
- Specified by:
zcountin interfaceBinaryJedisCommands
-
zcount
public Long zcount(byte[] key, byte[] min, byte[] max)
- Specified by:
zcountin interfaceBinaryJedisCommands
-
zrangeByScore
public 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).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
LIMITit'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
ZCOUNTcommand is similar toZRANGEBYSCOREbut 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 5Will return all the values with score > 1.3 and <= 5, while for instance:
ZRANGEBYSCORE zset (5 (10Will 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))
- Specified by:
zrangeByScorein interfaceBinaryJedisCommands- Parameters:
key-min-max-- Returns:
- Multi bulk reply specifically a list of elements in the specified score range.
- See Also:
zrangeByScore(byte[], double, double),zrangeByScore(byte[], double, double, int, int),zrangeByScoreWithScores(byte[], double, double),zrangeByScoreWithScores(byte[], double, double, int, int),zcount(byte[], double, double)
-
zrangeByScore
public Set<byte[]> zrangeByScore(byte[] key, byte[] min, byte[] max)
- Specified by:
zrangeByScorein interfaceBinaryJedisCommands
-
zrangeByScore
public 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).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
LIMITit'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
ZCOUNTcommand is similar toZRANGEBYSCOREbut 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 5Will return all the values with score > 1.3 and <= 5, while for instance:
ZRANGEBYSCORE zset (5 (10Will 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))
- Specified by:
zrangeByScorein interfaceBinaryJedisCommands- Parameters:
key-min-max-offset-count-- Returns:
- Multi bulk reply specifically a list of elements in the specified score range.
- See Also:
zrangeByScore(byte[], double, double),zrangeByScore(byte[], double, double, int, int),zrangeByScoreWithScores(byte[], double, double),zrangeByScoreWithScores(byte[], double, double, int, int),zcount(byte[], double, double)
-
zrangeByScore
public Set<byte[]> zrangeByScore(byte[] key, byte[] min, byte[] max, int offset, int count)
- Specified by:
zrangeByScorein interfaceBinaryJedisCommands
-
zrangeByScoreWithScores
public 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).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
LIMITit'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
ZCOUNTcommand is similar toZRANGEBYSCOREbut 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 5Will return all the values with score > 1.3 and <= 5, while for instance:
ZRANGEBYSCORE zset (5 (10Will 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))
- Specified by:
zrangeByScoreWithScoresin interfaceBinaryJedisCommands- Parameters:
key-min-max-- Returns:
- Multi bulk reply specifically a list of elements in the specified score range.
- See Also:
zrangeByScore(byte[], double, double),zrangeByScore(byte[], double, double, int, int),zrangeByScoreWithScores(byte[], double, double),zrangeByScoreWithScores(byte[], double, double, int, int),zcount(byte[], double, double)
-
zrangeByScoreWithScores
public Set<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max)
- Specified by:
zrangeByScoreWithScoresin interfaceBinaryJedisCommands
-
zrangeByScoreWithScores
public 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).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
LIMITit'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
ZCOUNTcommand is similar toZRANGEBYSCOREbut 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 5Will return all the values with score > 1.3 and <= 5, while for instance:
ZRANGEBYSCORE zset (5 (10Will 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))
- Specified by:
zrangeByScoreWithScoresin interfaceBinaryJedisCommands- Parameters:
key-min-max-offset-count-- Returns:
- Multi bulk reply specifically a list of elements in the specified score range.
- See Also:
zrangeByScore(byte[], double, double),zrangeByScore(byte[], double, double, int, int),zrangeByScoreWithScores(byte[], double, double),zrangeByScoreWithScores(byte[], double, double, int, int),zcount(byte[], double, double)
-
zrangeByScoreWithScores
public Set<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max, int offset, int count)
- Specified by:
zrangeByScoreWithScoresin interfaceBinaryJedisCommands
-
zrevrangeByScore
public Set<byte[]> zrevrangeByScore(byte[] key, double max, double min)
- Specified by:
zrevrangeByScorein interfaceBinaryJedisCommands
-
zrevrangeByScore
public Set<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min)
- Specified by:
zrevrangeByScorein interfaceBinaryJedisCommands
-
zrevrangeByScore
public Set<byte[]> zrevrangeByScore(byte[] key, double max, double min, int offset, int count)
- Specified by:
zrevrangeByScorein interfaceBinaryJedisCommands
-
zrevrangeByScore
public Set<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min, int offset, int count)
- Specified by:
zrevrangeByScorein interfaceBinaryJedisCommands
-
zrevrangeByScoreWithScores
public Set<Tuple> zrevrangeByScoreWithScores(byte[] key, double max, double min)
- Specified by:
zrevrangeByScoreWithScoresin interfaceBinaryJedisCommands
-
zrevrangeByScoreWithScores
public Set<Tuple> zrevrangeByScoreWithScores(byte[] key, double max, double min, int offset, int count)
- Specified by:
zrevrangeByScoreWithScoresin interfaceBinaryJedisCommands
-
zrevrangeByScoreWithScores
public Set<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min)
- Specified by:
zrevrangeByScoreWithScoresin interfaceBinaryJedisCommands
-
zrevrangeByScoreWithScores
public Set<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min, int offset, int count)
- Specified by:
zrevrangeByScoreWithScoresin interfaceBinaryJedisCommands
-
zremrangeByRank
public Long zremrangeByRank(byte[] key, long start, long stop)
Remove all elements in the sorted set at key with rank between start and end. Start and end are 0-based with rank 0 being the element with the lowest score. Both start and end can be negative numbers, where they indicate offsets starting at the element with the highest rank. For example: -1 is the element with the highest score, -2 the element with the second highest score and so forth.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
- Specified by:
zremrangeByRankin interfaceBinaryJedisCommands- Parameters:
key-start-stop-- Returns:
-
zremrangeByScore
public 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).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
- Specified by:
zremrangeByScorein interfaceBinaryJedisCommands- Parameters:
key-min-max-- Returns:
- Integer reply, specifically the number of elements removed.
-
zremrangeByScore
public Long zremrangeByScore(byte[] key, byte[] min, byte[] max)
- Specified by:
zremrangeByScorein interfaceBinaryJedisCommands
-
zunionstore
public 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. It is mandatory to provide the number of input keys N, before passing the input keys and the other (optional) arguments.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. Thezunionstore(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
- Specified by:
zunionstorein interfaceMultiKeyBinaryCommands- Parameters:
dstkey-sets-- Returns:
- Integer reply, specifically the number of elements in the sorted set at dstkey
- See Also:
zunionstore(byte[], byte[]...),zunionstore(byte[], ZParams, byte[]...),zinterstore(byte[], byte[]...),zinterstore(byte[], ZParams, byte[]...)
-
zunionstore
public 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. It is mandatory to provide the number of input keys N, before passing the input keys and the other (optional) arguments.As the terms imply, the
ZINTERSTOREcommand requires an element to be present in each of the given inputs to be inserted in the result. TheZUNIONSTOREcommand 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
- Specified by:
zunionstorein interfaceMultiKeyBinaryCommands- Parameters:
dstkey-sets-params-- Returns:
- Integer reply, specifically the number of elements in the sorted set at dstkey
- See Also:
zunionstore(byte[], byte[]...),zunionstore(byte[], ZParams, byte[]...),zinterstore(byte[], byte[]...),zinterstore(byte[], ZParams, byte[]...)
-
zinterstore
public 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. It is mandatory to provide the number of input keys N, before passing the input keys and the other (optional) arguments.As the terms imply, the
ZINTERSTOREcommand requires an element to be present in each of the given inputs to be inserted in the result. TheZUNIONSTOREcommand 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
- Specified by:
zinterstorein interfaceMultiKeyBinaryCommands- Parameters:
dstkey-sets-- Returns:
- Integer reply, specifically the number of elements in the sorted set at dstkey
- See Also:
zunionstore(byte[], byte[]...),zunionstore(byte[], ZParams, byte[]...),zinterstore(byte[], byte[]...),zinterstore(byte[], ZParams, byte[]...)
-
zinterstore
public 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. It is mandatory to provide the number of input keys N, before passing the input keys and the other (optional) arguments.As the terms imply, the
ZINTERSTOREcommand requires an element to be present in each of the given inputs to be inserted in the result. TheZUNIONSTOREcommand 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
- Specified by:
zinterstorein interfaceMultiKeyBinaryCommands- Parameters:
dstkey-sets-params-- Returns:
- Integer reply, specifically the number of elements in the sorted set at dstkey
- See Also:
zunionstore(byte[], byte[]...),zunionstore(byte[], ZParams, byte[]...),zinterstore(byte[], byte[]...),zinterstore(byte[], ZParams, byte[]...)
-
zlexcount
public Long zlexcount(byte[] key, byte[] min, byte[] max)
- Specified by:
zlexcountin interfaceBinaryJedisCommands
-
zrangeByLex
public Set<byte[]> zrangeByLex(byte[] key, byte[] min, byte[] max)
- Specified by:
zrangeByLexin interfaceBinaryJedisCommands
-
zrangeByLex
public Set<byte[]> zrangeByLex(byte[] key, byte[] min, byte[] max, int offset, int count)
- Specified by:
zrangeByLexin interfaceBinaryJedisCommands
-
zrevrangeByLex
public Set<byte[]> zrevrangeByLex(byte[] key, byte[] max, byte[] min)
- Specified by:
zrevrangeByLexin interfaceBinaryJedisCommands
-
zrevrangeByLex
public Set<byte[]> zrevrangeByLex(byte[] key, byte[] max, byte[] min, int offset, int count)
- Specified by:
zrevrangeByLexin interfaceBinaryJedisCommands
-
zremrangeByLex
public Long zremrangeByLex(byte[] key, byte[] min, byte[] max)
- Specified by:
zremrangeByLexin interfaceBinaryJedisCommands
-
save
public String save()
Synchronously save the DB on disk.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
BGSAVEthat is able to perform the saving in the background while the server continues serving other clients.- Specified by:
savein interfaceBasicCommands- Returns:
- Status code reply
-
bgsave
public String bgsave()
Asynchronously save the DB on disk.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.
- Specified by:
bgsavein interfaceBasicCommands- Returns:
- Status code reply
-
bgrewriteaof
public String bgrewriteaof()
Rewrite the append only file in background when it gets too big. Please for detailed information about the Redis Append Only File check the Append Only File Howto.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.
- Specified by:
bgrewriteaofin interfaceBasicCommands- Returns:
- Status code reply
-
lastsave
public Long lastsave()
Return the UNIX time stamp of the last successfully saving of the dataset on disk.Return the UNIX TIME of the last DB save executed with success. A client may check if a
BGSAVEcommand succeeded reading the LASTSAVE value, then issuing a BGSAVE command and checking at regular intervals every N seconds if LASTSAVE changed.- Specified by:
lastsavein interfaceBasicCommands- Returns:
- Integer reply, specifically an UNIX time stamp.
-
shutdown
public String shutdown()
Synchronously save the DB on disk, then shutdown the server.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
SAVEand thenQUITbecause other clients may alter the DB data between the two commands.- Specified by:
shutdownin interfaceBasicCommands- Returns:
- Status code reply on error. On success nothing is returned since the server quits and the connection is closed.
-
info
public String info()
Provide information and statistics about the server.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:0
Notesused_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.
- Specified by:
infoin interfaceBasicCommands- Returns:
- Bulk reply
-
info
public String info(String section)
Description copied from interface:BasicCommandsThe 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.- Specified by:
infoin interfaceBasicCommands- Parameters:
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)- Returns:
-
monitor
public void monitor(JedisMonitor jedisMonitor)
Dump all the received requests in real time.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.
- Parameters:
jedisMonitor-
-
slaveof
public String slaveof(String host, int port)
Change the replication settings.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.
- Specified by:
slaveofin interfaceBasicCommands- Parameters:
host-port-- Returns:
- Status code reply
-
slaveofNoOne
public String slaveofNoOne()
Description copied from interface:BasicCommandsSLAVEOF NO ONE will stop replication, turning the server into a MASTER, but will not discard the replication. So, if the old master stops working, it is possible to turn the slave into a master and set the application to use this new master in read/write. Later when the other Redis server is fixed, it can be reconfigured to work as a slave.- Specified by:
slaveofNoOnein interfaceBasicCommands- Returns:
- result of the command
-
configGet
public List<byte[]> configGet(byte[] pattern)
Retrieve the configuration of a running Redis server. Not all the configuration parameters are supported.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"
- Specified by:
configGetin interfaceAdvancedBinaryJedisCommands- Parameters:
pattern-- Returns:
- Bulk reply.
-
configResetStat
public String configResetStat()
Reset the stats returned by INFO- Specified by:
configResetStatin interfaceBasicCommands- Returns:
-
configRewrite
public 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. The rewrite is performed in a very conservative way:- Comments and the overall structure of the original redis.conf are preserved as much as possible.
- If an option already exists in the old redis.conf file, it will be rewritten at the same position (line number).
- If an option was not already present, but it is set to its default value, it is not added by the rewrite process.
- If an option was not already present, but it is set to a non-default value, it is appended at the end of the file.
- Non used lines are blanked. For instance if you used to have multiple save directives, but the current configuration has fewer or none as you disabled RDB persistence, all the lines will be blanked.
- Specified by:
configRewritein interfaceBasicCommands- Returns:
- OK when the configuration was rewritten properly. Otherwise an error is returned.
-
configSet
public byte[] configSet(byte[] parameter, byte[] value)Alter the configuration of a running Redis server. Not all the configuration parameters are supported.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:
- The save parameter is a list of space-separated integers. Every pair of integers specify the time and number of changes limit to trigger a save. For instance the command CONFIG SET save "3600 10 60 10000" will configure the server to issue a background saving of the RDB file every 3600 seconds if there are at least 10 changes in the dataset, and every 60 seconds if there are at least 10000 changes. To completely disable automatic snapshots just set the parameter as an empty string.
- All the integer parameters representing memory are returned and accepted only using bytes as unit.
- Specified by:
configSetin interfaceAdvancedBinaryJedisCommands- Parameters:
parameter-value-- Returns:
- Status code reply
-
isConnected
public boolean isConnected()
-
strlen
public Long strlen(byte[] key)
- Specified by:
strlenin interfaceBinaryJedisCommands
-
sync
public void sync()
-
lpushx
public Long lpushx(byte[] key, byte[]... string)
- Specified by:
lpushxin interfaceBinaryJedisCommands
-
persist
public Long persist(byte[] key)
Undo aexpireat turning the expire key into a normal key.Time complexity: O(1)
- Specified by:
persistin interfaceBinaryJedisCommands- Parameters:
key-- Returns:
- Integer reply, specifically: 1: the key is now persist. 0: the key is not persist (only happens when key not set).
-
rpushx
public Long rpushx(byte[] key, byte[]... string)
- Specified by:
rpushxin interfaceBinaryJedisCommands
-
echo
public byte[] echo(byte[] string)
- Specified by:
echoin interfaceBinaryJedisCommands
-
linsert
public Long linsert(byte[] key, ListPosition where, byte[] pivot, byte[] value)
- Specified by:
linsertin interfaceBinaryJedisCommands
-
debug
public String debug(DebugParams params)
- Specified by:
debugin interfaceBasicCommands
-
getClient
public Client getClient()
-
brpoplpush
public 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- Specified by:
brpoplpushin interfaceMultiKeyBinaryCommands- Parameters:
source-destination-timeout-- Returns:
- the element
-
setbit
public Boolean setbit(byte[] key, long offset, boolean value)
Sets or clears the bit at offset in the string value stored at key- Specified by:
setbitin interfaceBinaryJedisCommands- Parameters:
key-offset-value-- Returns:
-
setbit
public Boolean setbit(byte[] key, long offset, byte[] value)
- Specified by:
setbitin interfaceBinaryJedisCommands
-
getbit
public Boolean getbit(byte[] key, long offset)
Returns the bit value at offset in the string value stored at key- Specified by:
getbitin interfaceBinaryJedisCommands- Parameters:
key-offset-- Returns:
-
bitpos
public Long bitpos(byte[] key, boolean value)
-
bitpos
public Long bitpos(byte[] key, boolean value, BitPosParams params)
-
setrange
public Long setrange(byte[] key, long offset, byte[] value)
- Specified by:
setrangein interfaceBinaryJedisCommands
-
getrange
public byte[] getrange(byte[] key, long startOffset, long endOffset)- Specified by:
getrangein interfaceBinaryJedisCommands
-
publish
public Long publish(byte[] channel, byte[] message)
- Specified by:
publishin interfaceMultiKeyBinaryCommands
-
subscribe
public void subscribe(BinaryJedisPubSub jedisPubSub, byte[]... channels)
- Specified by:
subscribein interfaceMultiKeyBinaryCommands
-
psubscribe
public void psubscribe(BinaryJedisPubSub jedisPubSub, byte[]... patterns)
- Specified by:
psubscribein interfaceMultiKeyBinaryCommands
-
getDB
public int getDB()
Description copied from interface:BasicCommandsReturn the index of the current database- Specified by:
getDBin interfaceBasicCommands- Returns:
- the int of the index database.
-
eval
public Object eval(byte[] script, List<byte[]> keys, List<byte[]> args)
Evaluates scripts using the Lua interpreter built into Redis starting from version 2.6.0.- Specified by:
evalin interfaceBinaryScriptingCommands- Parameters:
script-keys-args-- Returns:
- Script result
-
getParamsWithBinary
protected static byte[][] getParamsWithBinary(List<byte[]> keys, List<byte[]> args)
-
eval
public Object eval(byte[] script, byte[] keyCount, byte[]... params)
- Specified by:
evalin interfaceBinaryScriptingCommands
-
eval
public Object eval(byte[] script, int keyCount, byte[]... params)
- Specified by:
evalin interfaceBinaryScriptingCommands
-
eval
public Object eval(byte[] script)
- Specified by:
evalin interfaceBinaryScriptingCommands
-
evalsha
public Object evalsha(byte[] sha1)
- Specified by:
evalshain interfaceBinaryScriptingCommands
-
evalsha
public Object evalsha(byte[] sha1, List<byte[]> keys, List<byte[]> args)
- Specified by:
evalshain interfaceBinaryScriptingCommands
-
evalsha
public Object evalsha(byte[] sha1, int keyCount, byte[]... params)
- Specified by:
evalshain interfaceBinaryScriptingCommands
-
scriptFlush
public String scriptFlush()
- Specified by:
scriptFlushin interfaceBinaryScriptingCommands
-
scriptExists
public Long scriptExists(byte[] sha1)
-
scriptExists
public List<Long> scriptExists(byte[]... sha1)
- Specified by:
scriptExistsin interfaceBinaryScriptingCommands
-
scriptLoad
public byte[] scriptLoad(byte[] script)
- Specified by:
scriptLoadin interfaceBinaryScriptingCommands
-
scriptKill
public String scriptKill()
- Specified by:
scriptKillin interfaceBinaryScriptingCommands
-
slowlogReset
public String slowlogReset()
- Specified by:
slowlogResetin interfaceAdvancedBinaryJedisCommands
-
slowlogLen
public Long slowlogLen()
- Specified by:
slowlogLenin interfaceAdvancedBinaryJedisCommands
-
slowlogGetBinary
public List<Object> slowlogGetBinary()
- Specified by:
slowlogGetBinaryin interfaceAdvancedBinaryJedisCommands
-
slowlogGetBinary
public List<Object> slowlogGetBinary(long entries)
- Specified by:
slowlogGetBinaryin interfaceAdvancedBinaryJedisCommands
-
objectRefcount
public Long objectRefcount(byte[] key)
- Specified by:
objectRefcountin interfaceAdvancedBinaryJedisCommands
-
objectEncoding
public byte[] objectEncoding(byte[] key)
- Specified by:
objectEncodingin interfaceAdvancedBinaryJedisCommands
-
objectIdletime
public Long objectIdletime(byte[] key)
- Specified by:
objectIdletimein interfaceAdvancedBinaryJedisCommands
-
objectHelpBinary
public List<byte[]> objectHelpBinary()
- Specified by:
objectHelpBinaryin interfaceAdvancedBinaryJedisCommands
-
objectFreq
public Long objectFreq(byte[] key)
- Specified by:
objectFreqin interfaceAdvancedBinaryJedisCommands
-
bitcount
public Long bitcount(byte[] key)
- Specified by:
bitcountin interfaceBinaryJedisCommands
-
bitcount
public Long bitcount(byte[] key, long start, long end)
- Specified by:
bitcountin interfaceBinaryJedisCommands
-
bitop
public Long bitop(BitOP op, byte[] destKey, byte[]... srcKeys)
- Specified by:
bitopin interfaceMultiKeyBinaryCommands
-
dump
public byte[] dump(byte[] key)
- Specified by:
dumpin interfaceBinaryJedisCommands
-
restore
public String restore(byte[] key, int ttl, byte[] serializedValue)
- Specified by:
restorein interfaceBinaryJedisCommands
-
restoreReplace
public String restoreReplace(byte[] key, int ttl, byte[] serializedValue)
- Specified by:
restoreReplacein interfaceBinaryJedisCommands
-
pexpire
public Long pexpire(byte[] key, long milliseconds)
Set a timeout on the specified key. After the timeout the key will be automatically deleted by the server. A key with an associated timeout is said to be volatile in Redis terminology.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
PERSISTcommand.Time complexity: O(1)
- Specified by:
pexpirein interfaceBinaryJedisCommands- Parameters:
key-milliseconds-- Returns:
- Integer reply, specifically: 1: the timeout was set. 0: the timeout was not set since the key already has an associated timeout (this may happen only in Redis versions < 2.1.3, Redis >= 2.1.3 will happily update the timeout), or the key does not exist.
- See Also:
- PEXPIRE Command
-
pexpireAt
public Long pexpireAt(byte[] key, long millisecondsTimestamp)
- Specified by:
pexpireAtin interfaceBinaryJedisCommands
-
pttl
public Long pttl(byte[] key)
- Specified by:
pttlin interfaceBinaryJedisCommands
-
psetex
public String psetex(byte[] key, long milliseconds, byte[] value)
PSETEX works exactly likesetex(byte[], int, byte[])with the sole difference that the expire time is specified in milliseconds instead of seconds. Time complexity: O(1)- Specified by:
psetexin interfaceBinaryJedisCommands- Parameters:
key-milliseconds-value-- Returns:
- Status code reply
-
memoryDoctorBinary
public byte[] memoryDoctorBinary()
- Specified by:
memoryDoctorBinaryin interfaceAdvancedBinaryJedisCommands
-
memoryUsage
public Long memoryUsage(byte[] key)
- Specified by:
memoryUsagein interfaceAdvancedBinaryJedisCommands
-
memoryUsage
public Long memoryUsage(byte[] key, int samples)
- Specified by:
memoryUsagein interfaceAdvancedBinaryJedisCommands
-
aclWhoAmIBinary
public byte[] aclWhoAmIBinary()
- Specified by:
aclWhoAmIBinaryin interfaceAdvancedBinaryJedisCommands
-
aclGenPassBinary
public byte[] aclGenPassBinary()
- Specified by:
aclGenPassBinaryin interfaceAdvancedBinaryJedisCommands
-
aclListBinary
public List<byte[]> aclListBinary()
- Specified by:
aclListBinaryin interfaceAdvancedBinaryJedisCommands
-
aclUsersBinary
public List<byte[]> aclUsersBinary()
- Specified by:
aclUsersBinaryin interfaceAdvancedBinaryJedisCommands
-
aclGetUser
public AccessControlUser aclGetUser(byte[] name)
- Specified by:
aclGetUserin interfaceAdvancedBinaryJedisCommands
-
aclSetUser
public String aclSetUser(byte[] name)
- Specified by:
aclSetUserin interfaceAdvancedBinaryJedisCommands
-
aclSetUser
public String aclSetUser(byte[] name, byte[]... keys)
- Specified by:
aclSetUserin interfaceAdvancedBinaryJedisCommands
-
aclDelUser
public Long aclDelUser(byte[] name)
- Specified by:
aclDelUserin interfaceAdvancedBinaryJedisCommands
-
aclCatBinary
public List<byte[]> aclCatBinary()
- Specified by:
aclCatBinaryin interfaceAdvancedBinaryJedisCommands
-
aclCat
public List<byte[]> aclCat(byte[] category)
- Specified by:
aclCatin interfaceAdvancedBinaryJedisCommands
-
aclLogBinary
public List<byte[]> aclLogBinary()
- Specified by:
aclLogBinaryin interfaceAdvancedBinaryJedisCommands
-
aclLogBinary
public List<byte[]> aclLogBinary(int limit)
- Specified by:
aclLogBinaryin interfaceAdvancedBinaryJedisCommands
-
aclLog
public byte[] aclLog(byte[] options)
- Specified by:
aclLogin interfaceAdvancedBinaryJedisCommands
-
clientKill
public String clientKill(byte[] ipPort)
- Specified by:
clientKillin interfaceAdvancedBinaryJedisCommands
-
clientKill
public String clientKill(String ip, int port)
- Specified by:
clientKillin interfaceAdvancedBinaryJedisCommands
-
clientKill
public Long clientKill(ClientKillParams params)
- Specified by:
clientKillin interfaceAdvancedBinaryJedisCommands
-
clientGetnameBinary
public byte[] clientGetnameBinary()
- Specified by:
clientGetnameBinaryin interfaceAdvancedBinaryJedisCommands
-
clientListBinary
public byte[] clientListBinary()
- Specified by:
clientListBinaryin interfaceAdvancedBinaryJedisCommands
-
clientSetname
public String clientSetname(byte[] name)
- Specified by:
clientSetnamein interfaceAdvancedBinaryJedisCommands
-
clientId
public Long clientId()
- Specified by:
clientIdin interfaceAdvancedBinaryJedisCommands
-
clientPause
public String clientPause(long timeout)
-
migrate
public String migrate(String host, int port, byte[] key, int destinationDb, int timeout)
- Specified by:
migratein interfaceAdvancedBinaryJedisCommands
-
migrate
public String migrate(String host, int port, int destinationDB, int timeout, MigrateParams params, byte[]... keys)
- Specified by:
migratein interfaceAdvancedBinaryJedisCommands
-
waitReplicas
public 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. Sorry :S- Specified by:
waitReplicasin interfaceBasicCommands- Parameters:
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 forever- Returns:
- the number of replicas reached by all the writes performed in the context of the current connection
-
pfadd
public Long pfadd(byte[] key, byte[]... elements)
- Specified by:
pfaddin interfaceBinaryJedisCommands
-
pfcount
public long pfcount(byte[] key)
- Specified by:
pfcountin interfaceBinaryJedisCommands
-
pfmerge
public String pfmerge(byte[] destkey, byte[]... sourcekeys)
- Specified by:
pfmergein interfaceMultiKeyBinaryCommands
-
pfcount
public Long pfcount(byte[]... keys)
- Specified by:
pfcountin interfaceMultiKeyBinaryCommands
-
scan
public ScanResult<byte[]> scan(byte[] cursor)
-
scan
public ScanResult<byte[]> scan(byte[] cursor, ScanParams params)
-
hscan
public ScanResult<Map.Entry<byte[],byte[]>> hscan(byte[] key, byte[] cursor)
- Specified by:
hscanin interfaceBinaryJedisCommands
-
hscan
public ScanResult<Map.Entry<byte[],byte[]>> hscan(byte[] key, byte[] cursor, ScanParams params)
- Specified by:
hscanin interfaceBinaryJedisCommands
-
sscan
public ScanResult<byte[]> sscan(byte[] key, byte[] cursor)
- Specified by:
sscanin interfaceBinaryJedisCommands
-
sscan
public ScanResult<byte[]> sscan(byte[] key, byte[] cursor, ScanParams params)
- Specified by:
sscanin interfaceBinaryJedisCommands
-
zscan
public ScanResult<Tuple> zscan(byte[] key, byte[] cursor)
- Specified by:
zscanin interfaceBinaryJedisCommands
-
zscan
public ScanResult<Tuple> zscan(byte[] key, byte[] cursor, ScanParams params)
- Specified by:
zscanin interfaceBinaryJedisCommands
-
geoadd
public Long geoadd(byte[] key, double longitude, double latitude, byte[] member)
- Specified by:
geoaddin interfaceBinaryJedisCommands
-
geoadd
public Long geoadd(byte[] key, Map<byte[],GeoCoordinate> memberCoordinateMap)
- Specified by:
geoaddin interfaceBinaryJedisCommands
-
geodist
public Double geodist(byte[] key, byte[] member1, byte[] member2)
- Specified by:
geodistin interfaceBinaryJedisCommands
-
geodist
public Double geodist(byte[] key, byte[] member1, byte[] member2, GeoUnit unit)
- Specified by:
geodistin interfaceBinaryJedisCommands
-
geohash
public List<byte[]> geohash(byte[] key, byte[]... members)
- Specified by:
geohashin interfaceBinaryJedisCommands
-
geopos
public List<GeoCoordinate> geopos(byte[] key, byte[]... members)
- Specified by:
geoposin interfaceBinaryJedisCommands
-
georadius
public List<GeoRadiusResponse> georadius(byte[] key, double longitude, double latitude, double radius, GeoUnit unit)
- Specified by:
georadiusin interfaceBinaryJedisCommands
-
georadiusReadonly
public List<GeoRadiusResponse> georadiusReadonly(byte[] key, double longitude, double latitude, double radius, GeoUnit unit)
- Specified by:
georadiusReadonlyin interfaceBinaryJedisCommands
-
georadius
public List<GeoRadiusResponse> georadius(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param)
- Specified by:
georadiusin interfaceBinaryJedisCommands
-
georadiusStore
public Long georadiusStore(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam)
- Specified by:
georadiusStorein interfaceMultiKeyBinaryCommands
-
georadiusReadonly
public List<GeoRadiusResponse> georadiusReadonly(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param)
- Specified by:
georadiusReadonlyin interfaceBinaryJedisCommands
-
georadiusByMember
public List<GeoRadiusResponse> georadiusByMember(byte[] key, byte[] member, double radius, GeoUnit unit)
- Specified by:
georadiusByMemberin interfaceBinaryJedisCommands
-
georadiusByMemberReadonly
public List<GeoRadiusResponse> georadiusByMemberReadonly(byte[] key, byte[] member, double radius, GeoUnit unit)
- Specified by:
georadiusByMemberReadonlyin interfaceBinaryJedisCommands
-
georadiusByMember
public List<GeoRadiusResponse> georadiusByMember(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param)
- Specified by:
georadiusByMemberin interfaceBinaryJedisCommands
-
georadiusByMemberStore
public Long georadiusByMemberStore(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam)
- Specified by:
georadiusByMemberStorein interfaceMultiKeyBinaryCommands
-
georadiusByMemberReadonly
public List<GeoRadiusResponse> georadiusByMemberReadonly(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param)
- Specified by:
georadiusByMemberReadonlyin interfaceBinaryJedisCommands
-
bitfield
public List<Long> bitfield(byte[] key, byte[]... arguments)
Description copied from interface:BinaryJedisCommandsExecutes BITFIELD Redis command- Specified by:
bitfieldin interfaceBinaryJedisCommands- Returns:
-
bitfieldReadonly
public List<Long> bitfieldReadonly(byte[] key, byte[]... arguments)
- Specified by:
bitfieldReadonlyin interfaceBinaryJedisCommands
-
hstrlen
public Long hstrlen(byte[] key, byte[] field)
Description copied from interface:BinaryJedisCommandsUsed for HSTRLEN Redis command- Specified by:
hstrlenin interfaceBinaryJedisCommands- Returns:
- lenth of the value for key
-
xread
public List<byte[]> xread(int count, long block, Map<byte[],byte[]> streams)
- Specified by:
xreadin interfaceMultiKeyBinaryCommands
-
xreadGroup
public List<byte[]> xreadGroup(byte[] groupname, byte[] consumer, int count, long block, boolean noAck, Map<byte[],byte[]> streams)
- Specified by:
xreadGroupin interfaceMultiKeyBinaryCommands
-
xadd
public byte[] xadd(byte[] key, byte[] id, Map<byte[],byte[]> hash, long maxLen, boolean approximateLength)- Specified by:
xaddin interfaceBinaryJedisCommands
-
xlen
public Long xlen(byte[] key)
- Specified by:
xlenin interfaceBinaryJedisCommands
-
xrange
public List<byte[]> xrange(byte[] key, byte[] start, byte[] end, long count)
- Specified by:
xrangein interfaceBinaryJedisCommands
-
xrevrange
public List<byte[]> xrevrange(byte[] key, byte[] end, byte[] start, int count)
- Specified by:
xrevrangein interfaceBinaryJedisCommands
-
xack
public Long xack(byte[] key, byte[] group, byte[]... ids)
- Specified by:
xackin interfaceBinaryJedisCommands
-
xgroupCreate
public String xgroupCreate(byte[] key, byte[] consumer, byte[] id, boolean makeStream)
- Specified by:
xgroupCreatein interfaceBinaryJedisCommands
-
xgroupSetID
public String xgroupSetID(byte[] key, byte[] consumer, byte[] id)
- Specified by:
xgroupSetIDin interfaceBinaryJedisCommands
-
xgroupDestroy
public Long xgroupDestroy(byte[] key, byte[] consumer)
- Specified by:
xgroupDestroyin interfaceBinaryJedisCommands
-
xgroupDelConsumer
public Long xgroupDelConsumer(byte[] key, byte[] consumer, byte[] consumerName)
- Specified by:
xgroupDelConsumerin interfaceBinaryJedisCommands
-
xdel
public Long xdel(byte[] key, byte[]... ids)
- Specified by:
xdelin interfaceBinaryJedisCommands
-
xtrim
public Long xtrim(byte[] key, long maxLen, boolean approximateLength)
- Specified by:
xtrimin interfaceBinaryJedisCommands
-
xpending
public List<byte[]> xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int count, byte[] consumername)
- Specified by:
xpendingin interfaceBinaryJedisCommands
-
xclaim
public List<byte[]> xclaim(byte[] key, byte[] groupname, byte[] consumername, long minIdleTime, long newIdleTime, int retries, boolean force, byte[][] ids)
- Specified by:
xclaimin interfaceBinaryJedisCommands
-
xinfoStream
public StreamInfo xinfoStream(byte[] key)
- Specified by:
xinfoStreamin interfaceBinaryJedisCommands
-
xinfoGroup
public List<StreamGroupInfo> xinfoGroup(byte[] key)
- Specified by:
xinfoGroupin interfaceBinaryJedisCommands
-
xinfoConsumers
public List<StreamConsumersInfo> xinfoConsumers(byte[] key, byte[] group)
- Specified by:
xinfoConsumersin interfaceBinaryJedisCommands
-
sendCommand
public Object sendCommand(ProtocolCommand cmd, byte[]... args)
-
sendBlockingCommand
public Object sendBlockingCommand(ProtocolCommand cmd, byte[]... args)
-
sendCommand
public Object sendCommand(ProtocolCommand cmd)
-
-