Class Jedis
- java.lang.Object
-
- redis.clients.jedis.BinaryJedis
-
- redis.clients.jedis.Jedis
-
- All Implemented Interfaces:
Closeable,AutoCloseable,AdvancedBinaryJedisCommands,AdvancedJedisCommands,BasicCommands,BinaryJedisCommands,BinaryScriptingCommands,ClusterCommands,JedisCommands,ModuleCommands,MultiKeyBinaryCommands,MultiKeyCommands,ScriptingCommands,SentinelCommands
public class Jedis extends BinaryJedis implements JedisCommands, MultiKeyCommands, AdvancedJedisCommands, ScriptingCommands, BasicCommands, ClusterCommands, SentinelCommands, ModuleCommands
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class redis.clients.jedis.BinaryJedis
BinaryJedis.SetFromList<E>
-
-
Field Summary
Fields Modifier and Type Field Description protected JedisPoolAbstractdataSource-
Fields inherited from class redis.clients.jedis.BinaryJedis
client, DUMMY_ARRAY, pipeline, transaction
-
-
Constructor Summary
Constructors Constructor Description Jedis()Jedis(String host)Jedis(String host, int port)Jedis(String host, int port, boolean ssl)Jedis(String host, int port, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)Jedis(String host, int port, int timeout)Jedis(String host, int port, int timeout, boolean ssl)Jedis(String host, int port, int timeout, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)Jedis(String host, int port, int connectionTimeout, int soTimeout)Jedis(String host, int port, int connectionTimeout, int soTimeout, boolean ssl)Jedis(String host, int port, int connectionTimeout, int soTimeout, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)Jedis(String host, int port, int connectionTimeout, int soTimeout, int infiniteSoTimeout)Jedis(String host, int port, int connectionTimeout, int soTimeout, int infiniteSoTimeout, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)Jedis(URI uri)Jedis(URI uri, int timeout)Jedis(URI uri, int connectionTimeout, int soTimeout)Jedis(URI uri, int connectionTimeout, int soTimeout, int infiniteSoTimeout, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)Jedis(URI uri, int connectionTimeout, int soTimeout, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)Jedis(URI uri, int timeout, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)Jedis(URI uri, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)Jedis(HostAndPort hp)Jedis(JedisShardInfo shardInfo)Jedis(JedisSocketFactory jedisSocketFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>aclCat()List<String>aclCat(String category)LongaclDelUser(String name)StringaclGenPass()AccessControlUseraclGetUser(String name)List<String>aclList()List<AccessControlLogEntry>aclLog()List<AccessControlLogEntry>aclLog(int limit)StringaclLog(String options)StringaclSetUser(String name)StringaclSetUser(String name, String... params)List<String>aclUsers()StringaclWhoAmI()Longappend(String key, String value)If the key already exists and is a string, this command appends the provided value at the end of the string.Stringasking()Longbitcount(String key)Longbitcount(String key, long start, long end)List<Long>bitfield(String key, String... arguments)Executes BITFIELD Redis commandList<Long>bitfieldReadonly(String key, String... arguments)Longbitop(BitOP op, String destKey, String... srcKeys)Longbitpos(String key, boolean value)Longbitpos(String key, boolean value, BitPosParams params)List<String>blpop(int timeout, String key)List<String>blpop(int timeout, String... keys)BLPOP (and BRPOP) is a blocking list pop primitive.List<String>blpop(String... args)List<String>brpop(int timeout, String key)List<String>brpop(int timeout, String... keys)BLPOP (and BRPOP) is a blocking list pop primitive.List<String>brpop(String... args)Stringbrpoplpush(String source, String destination, int timeout)Pop a value from a list, push it to another list and return it; or block until one is availableStringclientGetname()LongclientId()StringclientKill(String ipPort)StringclientList()StringclientSetname(String name)voidclose()StringclusterAddSlots(int... slots)LongclusterCountKeysInSlot(int slot)StringclusterDelSlots(int... slots)StringclusterFailover()StringclusterFlushSlots()StringclusterForget(String nodeId)List<String>clusterGetKeysInSlot(int slot, int count)StringclusterInfo()LongclusterKeySlot(String key)StringclusterMeet(String ip, int port)StringclusterNodes()StringclusterReplicate(String nodeId)StringclusterReset(ClusterReset resetType)StringclusterSaveConfig()StringclusterSetSlotImporting(int slot, String nodeId)StringclusterSetSlotMigrating(int slot, String nodeId)StringclusterSetSlotNode(int slot, String nodeId)StringclusterSetSlotStable(int slot)List<String>clusterSlaves(String nodeId)List<Object>clusterSlots()List<String>configGet(String pattern)Retrieve the configuration of a running Redis server.StringconfigSet(String parameter, String value)Alter the configuration of a running Redis server.Longdecr(String key)Decrement the number stored at key by one.LongdecrBy(String key, long decrement)IDECRBY work just likeINCRbut instead to decrement by 1 the decrement is integer.Longdel(String key)Longdel(String... keys)Remove the specified keys.byte[]dump(String key)Stringecho(String string)Objecteval(String script)Objecteval(String script, int keyCount, String... params)Objecteval(String script, List<String> keys, List<String> args)Objectevalsha(String sha1)Objectevalsha(String sha1, int keyCount, String... params)Objectevalsha(String sha1, List<String> keys, List<String> args)Booleanexists(String key)Test if the specified key exists.Longexists(String... keys)Test if the specified keys exist.Longexpire(String key, int seconds)Set a timeout on the specified key.LongexpireAt(String 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).Longgeoadd(String key, double longitude, double latitude, String member)Longgeoadd(String key, Map<String,GeoCoordinate> memberCoordinateMap)Doublegeodist(String key, String member1, String member2)Doublegeodist(String key, String member1, String member2, GeoUnit unit)List<String>geohash(String key, String... members)List<GeoCoordinate>geopos(String key, String... members)List<GeoRadiusResponse>georadius(String key, double longitude, double latitude, double radius, GeoUnit unit)List<GeoRadiusResponse>georadius(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param)List<GeoRadiusResponse>georadiusByMember(String key, String member, double radius, GeoUnit unit)List<GeoRadiusResponse>georadiusByMember(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param)List<GeoRadiusResponse>georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit)List<GeoRadiusResponse>georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param)LonggeoradiusByMemberStore(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam)List<GeoRadiusResponse>georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit)List<GeoRadiusResponse>georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param)LonggeoradiusStore(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam)Stringget(String key)Get the value of the specified key.Booleangetbit(String key, long offset)Returns the bit value at offset in the string value stored at keyprotected static String[]getParams(List<String> keys, List<String> args)Stringgetrange(String key, long startOffset, long endOffset)StringgetSet(String key, String value)GETSET is an atomic set this value and return the old value command.Longhdel(String key, String... fields)Remove the specified field from an hash stored at key.Booleanhexists(String key, String field)Test for existence of a specified field in a hash.Stringhget(String key, String field)If key holds a hash, retrieve the value associated to the specified field.Map<String,String>hgetAll(String key)Return all the fields and associated values in a hash.LonghincrBy(String key, String field, long value)Increment the number stored at field in the hash at key by value.DoublehincrByFloat(String key, String field, double value)Increment the number stored at field in the hash at key by a double precision floating point value.Set<String>hkeys(String key)Return all the fields in a hash.Longhlen(String key)Return the number of items in a hash.List<String>hmget(String key, String... fields)Retrieve the values associated to the specified fields.Stringhmset(String key, Map<String,String> hash)Set the respective fields to the respective values.ScanResult<Map.Entry<String,String>>hscan(String key, String cursor)ScanResult<Map.Entry<String,String>>hscan(String key, String cursor, ScanParams params)Longhset(String key, String field, String value)Set the specified hash field to the specified value.Longhset(String key, Map<String,String> hash)Longhsetnx(String key, String field, String value)Set the specified hash field to the specified value if the field not exists.Longhstrlen(String key, String field)Used for HSTRLEN Redis commandList<String>hvals(String key)Return all the values in a hash.Longincr(String key)Increment the number stored at key by one.LongincrBy(String key, long increment)INCRBY work just likeINCRbut instead to increment by 1 the increment is integer.DoubleincrByFloat(String key, double increment)INCRBYFLOATSet<String>keys(String pattern)Returns all the keys matching the glob-style pattern.Stringlindex(String key, long index)Return the specified element of the list stored at the specified key.Longlinsert(String key, ListPosition where, String pivot, String value)Longllen(String key)Return the length of the list stored at the specified key.Stringlpop(String key)Atomically return and remove the first (LPOP) or last (RPOP) element of the list.List<String>lpop(String key, int count)Longlpos(String key, String element)Longlpos(String key, String element, LPosParams params)List<Long>lpos(String key, String element, LPosParams params, long count)Longlpush(String key, String... strings)Add the string value to the head (LPUSH) or tail (RPUSH) of the list stored at key.Longlpushx(String key, String... string)List<String>lrange(String key, long start, long stop)Return the specified elements of the list stored at the specified key.Longlrem(String key, long count, String value)Remove the first count occurrences of the value element from the list.Stringlset(String key, long index, String value)Set a new value as the element at index position of the List at key.Stringltrim(String key, long start, long stop)Trim an existing list so that it will contain only the specified range of elements specified.StringmemoryDoctor()LongmemoryUsage(String key)LongmemoryUsage(String key, int samples)List<String>mget(String... keys)Get the values of all the specified keys.Stringmigrate(String host, int port, int destinationDB, int timeout, MigrateParams params, String... keys)Stringmigrate(String host, int port, String key, int destinationDb, int timeout)List<Module>moduleList()StringmoduleLoad(String path)StringmoduleUnload(String name)Longmove(String key, int dbIndex)Move the specified key from the currently selected DB to the specified destination DB.Stringmset(String... keysvalues)Set the the respective keys to the respective values.Longmsetnx(String... keysvalues)Set the the respective keys to the respective values.StringobjectEncoding(String key)LongobjectFreq(String key)List<String>objectHelp()LongobjectIdletime(String key)LongobjectRefcount(String key)Longpersist(String key)Undo aexpireat turning the expire key into a normal key.Longpexpire(String key, long milliseconds)LongpexpireAt(String key, long millisecondsTimestamp)Longpfadd(String key, String... elements)longpfcount(String key)longpfcount(String... keys)Stringpfmerge(String destkey, String... sourcekeys)Stringping(String message)Works same as ping() but returns argument message instead of PONG.Stringpsetex(String key, long milliseconds, String value)PSETEX works exactly likesetex(String, int, String)with the sole difference that the expire time is specified in milliseconds instead of seconds.voidpsubscribe(JedisPubSub jedisPubSub, String... patterns)Longpttl(String key)Longpublish(String channel, String message)List<String>pubsubChannels(String pattern)LongpubsubNumPat()Map<String,String>pubsubNumSub(String... channels)StringrandomKey()Return a randomly selected key from the currently selected DB.Stringreadonly()Stringrename(String oldkey, String newkey)Atomically renames the key oldkey to newkey.Longrenamenx(String oldkey, String newkey)Rename oldkey into newkey but fails if the destination key newkey already exists.Stringrestore(String key, int ttl, byte[] serializedValue)StringrestoreReplace(String key, int ttl, byte[] serializedValue)Stringrpop(String key)Atomically return and remove the first (LPOP) or last (RPOP) element of the list.List<String>rpop(String key, int count)Stringrpoplpush(String srckey, String 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(String key, String... strings)Add the string value to the head (LPUSH) or tail (RPUSH) of the list stored at key.Longrpushx(String key, String... string)Longsadd(String key, String... members)Add the specified member to the set value stored at key.ScanResult<String>scan(String cursor)ScanResult<String>scan(String cursor, ScanParams params)Iterates the set of keys in the currently selected Redis database.Longscard(String key)Return the set cardinality (number of elements).BooleanscriptExists(String sha1)List<Boolean>scriptExists(String... sha1)StringscriptLoad(String script)Set<String>sdiff(String... keys)Return the difference between the Set stored at key1 and all the Sets key2, ..., keyNLongsdiffstore(String dstkey, String... keys)This command works exactly likeSDIFFbut instead of being returned the resulting set is stored in dstkey.ObjectsendBlockingCommand(ProtocolCommand cmd, String... args)ObjectsendCommand(ProtocolCommand cmd, String... args)StringsentinelFailover(String masterName)List<String>sentinelGetMasterAddrByName(String masterName)redis 127.0.0.1:26381> sentinel get-master-addr-by-name mymaster 1) "127.0.0.1" 2) "6379"List<Map<String,String>>sentinelMasters()redis 127.0.0.1:26381> sentinel masters 1) 1) "name" 2) "mymaster" 3) "ip" 4) "127.0.0.1" 5) "port" 6) "6379" 7) "runid" 8) "93d4d4e6e9c06d0eea36e27f31924ac26576081d" 9) "flags" 10) "master" 11) "pending-commands" 12) "0" 13) "last-ok-ping-reply" 14) "423" 15) "last-ping-reply" 16) "423" 17) "info-refresh" 18) "6107" 19) "num-slaves" 20) "1" 21) "num-other-sentinels" 22) "2" 23) "quorum" 24) "2"StringsentinelMonitor(String masterName, String ip, int port, int quorum)StringsentinelRemove(String masterName)LongsentinelReset(String pattern)redis 127.0.0.1:26381> sentinel reset mymaster (integer) 1StringsentinelSet(String masterName, Map<String,String> parameterMap)List<Map<String,String>>sentinelSlaves(String masterName)redis 127.0.0.1:26381> sentinel slaves mymaster 1) 1) "name" 2) "127.0.0.1:6380" 3) "ip" 4) "127.0.0.1" 5) "port" 6) "6380" 7) "runid" 8) "d7f6c0ca7572df9d2f33713df0dbf8c72da7c039" 9) "flags" 10) "slave" 11) "pending-commands" 12) "0" 13) "last-ok-ping-reply" 14) "47" 15) "last-ping-reply" 16) "47" 17) "info-refresh" 18) "657" 19) "master-link-down-time" 20) "0" 21) "master-link-status" 22) "ok" 23) "master-host" 24) "localhost" 25) "master-port" 26) "6379" 27) "slave-priority" 28) "100"Stringset(String key, String value)Set the string value as value of the key.Stringset(String key, String value, SetParams params)Set the string value as value of the key.Booleansetbit(String key, long offset, boolean value)Sets or clears the bit at offset in the string value stored at keyBooleansetbit(String key, long offset, String value)voidsetDataSource(JedisPoolAbstract jedisPool)Stringsetex(String key, int seconds, String value)Longsetnx(String key, String value)SETNX works exactly likeSETwith the only difference that if the key already exists no operation is performed.Longsetrange(String key, long offset, String value)Set<String>sinter(String... keys)Return the members of a set resulting from the intersection of all the sets hold at the specified keys.Longsinterstore(String dstkey, String... keys)This command works exactly likeSINTERbut instead of being returned the resulting set is stored as dstkey.Booleansismember(String key, String member)Return true if member is a member of the set stored at key, otherwise false is returned.List<Slowlog>slowlogGet()List<Slowlog>slowlogGet(long entries)Set<String>smembers(String key)Return all the members (elements) of the set value stored at key.List<Boolean>smismember(String key, String... members)Returns whether each member is a member of the set stored at key.Longsmove(String srckey, String dstkey, String member)Move the specified member from the set at srckey to the set at dstkey.List<String>sort(String key)Sort a Set or a List.Longsort(String key, String dstkey)Sort a Set or a List and Store the Result at dstkey.List<String>sort(String key, SortingParams sortingParameters)Sort a Set or a List accordingly to the specified parameters.Longsort(String key, SortingParams sortingParameters, String dstkey)Sort a Set or a List accordingly to the specified parameters and store the result at dstkey.Stringspop(String key)Remove a random element from a Set returning it as return value.Set<String>spop(String key, long count)Stringsrandmember(String key)Return a random element from a Set, without removing the element.List<String>srandmember(String key, int count)Longsrem(String key, String... members)Remove the specified member from the set value stored at key.ScanResult<String>sscan(String key, String cursor)ScanResult<String>sscan(String key, String cursor, ScanParams params)Longstrlen(String key)voidsubscribe(JedisPubSub jedisPubSub, String... channels)Stringsubstr(String key, int start, int end)Return a subset of the string from offset start to offset end (both offsets are inclusive).Set<String>sunion(String... keys)Return the members of a set resulting from the union of all the sets hold at the specified keys.Longsunionstore(String dstkey, String... keys)This command works exactly likeSUNIONbut instead of being returned the resulting set is stored as dstkey.Longtouch(String key)Longtouch(String... keys)Alters the last access time of a key(s).Longttl(String key)The TTL command returns the remaining time to live in seconds of a key that has anEXPIREset.Stringtype(String key)Return the type of the value stored at key in form of a string.Longunlink(String key)Longunlink(String... keys)This command is very similar to DEL: it removes the specified keys.Stringwatch(String... keys)longxack(String key, String group, StreamEntryID... ids)XACK key group ID [ID ...]StreamEntryIDxadd(String key, StreamEntryID id, Map<String,String> hash)XADD key ID field string [field string ...]StreamEntryIDxadd(String key, StreamEntryID id, Map<String,String> hash, long maxLen, boolean approximateLength)XADD key MAXLEN ~ LEN ID field string [field string ...]List<StreamEntry>xclaim(String key, String group, String consumername, long minIdleTime, long newIdleTime, int retries, boolean force, StreamEntryID... ids)XCLAIM[IDLE ] [TIME ] [RETRYCOUNT ] [FORCE] [JUSTID] longxdel(String key, StreamEntryID... ids)XDEL key ID [ID ...]StringxgroupCreate(String key, String groupname, StreamEntryID id, boolean makeStream)XGROUP CREATELongxgroupDelConsumer(String key, String groupname, String consumerName)XGROUP DELCONSUMERlongxgroupDestroy(String key, String groupname)XGROUP DESTROYStringxgroupSetID(String key, String groupname, StreamEntryID id)XGROUP SETIDList<StreamConsumersInfo>xinfoConsumers(String key, String group)Introspection command used in order to retrieve different information about consumers in the groupList<StreamGroupInfo>xinfoGroup(String key)Introspection command used in order to retrieve different information about groups in the streamStreamInfoxinfoStream(String key)Introspection command used in order to retrieve different information about the streamLongxlen(String key)XLEN keyList<StreamPendingEntry>xpending(String key, String groupname, StreamEntryID start, StreamEntryID end, int count, String consumername)XPENDING key group [start end count] [consumer]List<StreamEntry>xrange(String key, StreamEntryID start, StreamEntryID end, int count)XRANGE key start end [COUNT count]List<Map.Entry<String,List<StreamEntry>>>xread(int count, long block, Map.Entry<String,StreamEntryID>... streams)XREAD [COUNT count] [BLOCK milliseconds] STREAMS key [key ...] ID [ID ...]List<Map.Entry<String,List<StreamEntry>>>xreadGroup(String groupname, String consumer, int count, long block, boolean noAck, Map.Entry<String,StreamEntryID>... streams)XREAD [COUNT count] [BLOCK milliseconds] STREAMS key [key ...] ID [ID ...]List<StreamEntry>xrevrange(String key, StreamEntryID end, StreamEntryID start, int count)XREVRANGE key end start [COUNT] longxtrim(String key, long maxLen, boolean approximateLength)XTRIM key MAXLEN [~] countLongzadd(String key, double score, String member)Add the specified member having the specified score to the sorted set stored at key.Longzadd(String key, double score, String member, ZAddParams params)Longzadd(String key, Map<String,Double> scoreMembers)Longzadd(String key, Map<String,Double> scoreMembers, ZAddParams params)Longzcard(String key)Return the sorted set cardinality (number of elements).Longzcount(String key, double min, double max)Longzcount(String key, String min, String max)Doublezincrby(String key, double increment, String 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(String key, double increment, String member, ZIncrByParams params)Longzinterstore(String dstkey, String... sets)Creates a union or intersection of N sorted sets given by keys k1 through kN, and stores it at dstkey.Longzinterstore(String dstkey, ZParams params, String... sets)Creates a union or intersection of N sorted sets given by keys k1 through kN, and stores it at dstkey.Longzlexcount(String key, String min, String max)List<Double>zmscore(String key, String... members)Returns the scores associated with the specified members in the sorted set stored at key.Tuplezpopmax(String key)Set<Tuple>zpopmax(String key, int count)Tuplezpopmin(String key)Set<Tuple>zpopmin(String key, int count)Set<String>zrange(String key, long start, long stop)Set<String>zrangeByLex(String key, String min, String max)Set<String>zrangeByLex(String key, String min, String max, int offset, int count)Set<String>zrangeByScore(String 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<String>zrangeByScore(String 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<String>zrangeByScore(String key, String min, String max)Set<String>zrangeByScore(String key, String min, String max, int offset, int count)Set<Tuple>zrangeByScoreWithScores(String 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(String 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(String key, String min, String max)Set<Tuple>zrangeByScoreWithScores(String key, String min, String max, int offset, int count)Set<Tuple>zrangeWithScores(String key, long start, long stop)Longzrank(String key, String member)Return the rank (or index) of member in the sorted set at key, with scores being ordered from low to high.Longzrem(String key, String... members)Remove the specified member from the sorted set value stored at key.LongzremrangeByLex(String key, String min, String max)LongzremrangeByRank(String key, long start, long stop)Remove all elements in the sorted set at key with rank between start and end.LongzremrangeByScore(String 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).LongzremrangeByScore(String key, String min, String max)Set<String>zrevrange(String key, long start, long stop)Set<String>zrevrangeByLex(String key, String max, String min)Set<String>zrevrangeByLex(String key, String max, String min, int offset, int count)Set<String>zrevrangeByScore(String key, double max, double min)Set<String>zrevrangeByScore(String key, double max, double min, int offset, int count)Set<String>zrevrangeByScore(String key, String max, String min)Set<String>zrevrangeByScore(String key, String max, String min, int offset, int count)Set<Tuple>zrevrangeByScoreWithScores(String key, double max, double min)Set<Tuple>zrevrangeByScoreWithScores(String key, double max, double min, int offset, int count)Set<Tuple>zrevrangeByScoreWithScores(String key, String max, String min)Set<Tuple>zrevrangeByScoreWithScores(String key, String max, String min, int offset, int count)Set<Tuple>zrevrangeWithScores(String key, long start, long stop)Longzrevrank(String key, String member)Return the rank (or index) of member in the sorted set at key, with scores being ordered from high to low.ScanResult<Tuple>zscan(String key, String cursor)ScanResult<Tuple>zscan(String key, String cursor, ScanParams params)Doublezscore(String key, String member)Return the score of the specified element of the sorted set at key.Longzunionstore(String dstkey, String... sets)Creates a union or intersection of N sorted sets given by keys k1 through kN, and stores it at dstkey.Longzunionstore(String dstkey, ZParams params, String... sets)Creates a union or intersection of N sorted sets given by keys k1 through kN, and stores it at dstkey.-
Methods inherited from class redis.clients.jedis.BinaryJedis
aclCat, aclCatBinary, aclDelUser, aclGenPassBinary, aclGetUser, aclListBinary, aclLog, aclLogBinary, aclLogBinary, aclSetUser, aclSetUser, aclUsersBinary, aclWhoAmIBinary, append, auth, auth, bgrewriteaof, bgsave, bitcount, bitcount, bitfield, bitfieldReadonly, bitop, bitpos, bitpos, blpop, blpop, brpop, brpop, brpoplpush, checkIsInMultiOrPipeline, clientGetnameBinary, clientKill, clientKill, clientKill, clientListBinary, clientPause, clientSetname, configGet, configResetStat, configRewrite, configSet, connect, dbSize, debug, decr, decrBy, del, del, disconnect, dump, echo, eval, eval, eval, eval, evalsha, evalsha, evalsha, exists, exists, expire, expireAt, flushAll, flushDB, geoadd, geoadd, geodist, geodist, geohash, geopos, georadius, georadius, georadiusByMember, georadiusByMember, georadiusByMemberReadonly, georadiusByMemberReadonly, georadiusByMemberStore, georadiusReadonly, georadiusReadonly, georadiusStore, get, getbit, getClient, getDB, getParamsWithBinary, getrange, getSet, getTupledSet, hdel, hexists, hget, hgetAll, hincrBy, hincrByFloat, hkeys, hlen, hmget, hmset, hscan, hscan, hset, hset, hsetnx, hstrlen, hvals, incr, incrBy, incrByFloat, info, info, isConnected, keys, lastsave, lindex, linsert, llen, lpop, lpop, lpos, lpos, lpos, lpush, lpushx, lrange, lrem, lset, ltrim, memoryDoctorBinary, memoryUsage, memoryUsage, mget, migrate, migrate, monitor, move, mset, msetnx, multi, objectEncoding, objectFreq, objectHelpBinary, objectIdletime, objectRefcount, persist, pexpire, pexpireAt, pfadd, pfcount, pfcount, pfmerge, ping, ping, pipelined, psetex, psubscribe, pttl, publish, quit, randomBinaryKey, rename, renamenx, resetState, restore, restoreReplace, rpop, rpop, rpoplpush, rpush, rpushx, sadd, save, scan, scan, scard, scriptExists, scriptExists, scriptFlush, scriptKill, scriptLoad, sdiff, sdiffstore, select, sendBlockingCommand, sendCommand, sendCommand, set, set, setbit, setbit, setex, setnx, setrange, shutdown, sinter, sinterstore, sismember, slaveof, slaveofNoOne, slowlogGetBinary, slowlogGetBinary, slowlogLen, slowlogReset, smembers, smismember, smove, sort, sort, sort, sort, spop, spop, srandmember, srandmember, srem, sscan, sscan, strlen, subscribe, substr, sunion, sunionstore, swapDB, sync, time, touch, touch, ttl, type, unlink, unlink, unwatch, waitReplicas, watch, xack, xadd, xclaim, xdel, xgroupCreate, xgroupDelConsumer, xgroupDestroy, xgroupSetID, xinfoConsumers, xinfoGroup, xinfoStream, xlen, xpending, xrange, xread, xreadGroup, xrevrange, xtrim, zadd, zadd, zadd, zadd, zcard, zcount, zcount, zincrby, zincrby, zinterstore, zinterstore, zlexcount, zmscore, zpopmax, zpopmax, zpopmin, zpopmin, zrange, zrangeByLex, zrangeByLex, zrangeByScore, zrangeByScore, zrangeByScore, zrangeByScore, zrangeByScoreWithScores, zrangeByScoreWithScores, zrangeByScoreWithScores, zrangeByScoreWithScores, zrangeWithScores, zrank, zrem, zremrangeByLex, zremrangeByRank, zremrangeByScore, zremrangeByScore, zrevrange, zrevrangeByLex, zrevrangeByLex, zrevrangeByScore, zrevrangeByScore, zrevrangeByScore, zrevrangeByScore, zrevrangeByScoreWithScores, zrevrangeByScoreWithScores, zrevrangeByScoreWithScores, zrevrangeByScoreWithScores, zrevrangeWithScores, zrevrank, zscan, zscan, zscore, zunionstore, zunionstore
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface redis.clients.jedis.commands.AdvancedJedisCommands
clientKill, clientKill, slowlogLen, slowlogReset
-
Methods inherited from interface redis.clients.jedis.commands.BasicCommands
auth, auth, bgrewriteaof, bgsave, configResetStat, configRewrite, dbSize, debug, flushAll, flushDB, getDB, info, info, lastsave, ping, quit, save, select, shutdown, slaveof, slaveofNoOne, swapDB, waitReplicas
-
Methods inherited from interface redis.clients.jedis.commands.MultiKeyCommands
unwatch
-
-
-
-
Field Detail
-
dataSource
protected JedisPoolAbstract dataSource
-
-
Constructor Detail
-
Jedis
public Jedis()
-
Jedis
public Jedis(String host)
-
Jedis
public Jedis(HostAndPort hp)
-
Jedis
public Jedis(String host, int port)
-
Jedis
public Jedis(String host, int port, boolean ssl)
-
Jedis
public Jedis(String host, int port, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
-
Jedis
public Jedis(String host, int port, int timeout)
-
Jedis
public Jedis(String host, int port, int timeout, boolean ssl)
-
Jedis
public Jedis(String host, int port, int timeout, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
-
Jedis
public Jedis(String host, int port, int connectionTimeout, int soTimeout)
-
Jedis
public Jedis(String host, int port, int connectionTimeout, int soTimeout, int infiniteSoTimeout)
-
Jedis
public Jedis(String host, int port, int connectionTimeout, int soTimeout, boolean ssl)
-
Jedis
public Jedis(String host, int port, int connectionTimeout, int soTimeout, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
-
Jedis
public Jedis(String host, int port, int connectionTimeout, int soTimeout, int infiniteSoTimeout, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
-
Jedis
public Jedis(JedisShardInfo shardInfo)
-
Jedis
public Jedis(URI uri)
-
Jedis
public Jedis(URI uri, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
-
Jedis
public Jedis(URI uri, int timeout)
-
Jedis
public Jedis(URI uri, int timeout, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
-
Jedis
public Jedis(URI uri, int connectionTimeout, int soTimeout)
-
Jedis
public Jedis(URI uri, int connectionTimeout, int soTimeout, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
-
Jedis
public Jedis(URI uri, int connectionTimeout, int soTimeout, int infiniteSoTimeout, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
-
Jedis
public Jedis(JedisSocketFactory jedisSocketFactory)
-
-
Method Detail
-
ping
public String ping(String message)
Works same as ping() but returns argument message instead of PONG.- Parameters:
message-- Returns:
- message
-
set
public String set(String key, String 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 interfaceJedisCommands- Parameters:
key-value-- Returns:
- Status code reply
-
set
public String set(String key, String 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 interfaceJedisCommands- Parameters:
key-value-params- NX|XX, NX -- Only set the key if it does not already exist. XX -- Only set the key if it already exist. EX|PX, expire time units: EX = seconds; PX = milliseconds- Returns:
- Status code reply
-
get
public String get(String key)
Get the value of the specified key. If the key does not exist null 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 interfaceJedisCommands- Parameters:
key-- Returns:
- Bulk reply
-
exists
public Long exists(String... keys)
Test if the specified keys exist. The command returns the number of keys exist. Time complexity: O(N)- Specified by:
existsin interfaceMultiKeyCommands- 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(String 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 interfaceJedisCommands- Parameters:
key-- Returns:
- Boolean reply, true if the key exists, otherwise false
-
del
public Long del(String... 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 interfaceMultiKeyCommands- 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(String key)
- Specified by:
delin interfaceJedisCommands
-
unlink
public Long unlink(String... 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 interfaceMultiKeyCommands- Parameters:
keys-- Returns:
- Integer reply: The number of keys that were unlinked
-
unlink
public Long unlink(String key)
- Specified by:
unlinkin interfaceJedisCommands
-
type
public String type(String 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 interfaceJedisCommands- 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
-
keys
public Set<String> keys(String pattern)
Description copied from interface:MultiKeyCommandsReturns all the keys matching the glob-style pattern. For example if you have in the database the keys "foo" and "foobar" the command "KEYS foo*" will return "foo foobar".
Warning: consider this as a command that should be used in production environments with extreme care. It may ruin performance when it is executed against large databases. This command is intended for debugging and special operations, such as changing your keyspace layout. Don't use it in your regular application code. If you're looking for a way to find keys in a subset of your keyspace, consider usingMultiKeyCommands.scan(String, ScanParams)or sets.While the time complexity for this operation is O(N), the constant times are fairly low. For example, Redis running on an entry level laptop can scan a 1 million key database in 40 milliseconds.
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 interfaceMultiKeyCommands- Returns:
- Multi bulk reply
- See Also:
- Redis KEYS documentation
-
randomKey
public String randomKey()
Return a randomly selected key from the currently selected DB.Time complexity: O(1)
- Specified by:
randomKeyin interfaceMultiKeyCommands- Returns:
- Singe line reply, specifically the randomly selected key or an empty string is the database is empty
-
rename
public String rename(String oldkey, String 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 interfaceMultiKeyCommands- Parameters:
oldkey-newkey-- Returns:
- Status code repy
-
renamenx
public Long renamenx(String oldkey, String newkey)
Rename oldkey into newkey but fails if the destination key newkey already exists.Time complexity: O(1)
- Specified by:
renamenxin interfaceMultiKeyCommands- Parameters:
oldkey-newkey-- Returns:
- Integer reply, specifically: 1 if the key was renamed 0 if the target key already exist
-
expire
public Long expire(String 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 interfaceJedisCommands- 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(String 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 interfaceJedisCommands- 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(String 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 interfaceJedisCommands- Parameters:
key-- Returns:
- Integer reply, returns the remaining time to live in seconds of a key that has an EXPIRE. In Redis 2.6 or older, if the Key does not exists or does not have an associated expire, -1 is returned. In Redis 2.8 or newer, if the Key does not have an associated expire, -1 is returned or if the Key does not exists, -2 is returned.
-
touch
public Long touch(String... 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 interfaceMultiKeyCommands- Parameters:
keys-- Returns:
- Integer reply: The number of keys that were touched.
-
touch
public Long touch(String key)
- Specified by:
touchin interfaceJedisCommands
-
move
public Long move(String 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 interfaceJedisCommands- 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.
-
getSet
public String getSet(String key, String 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 interfaceJedisCommands- Parameters:
key-value-- Returns:
- Bulk reply
-
mget
public List<String> mget(String... 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 interfaceMultiKeyCommands- Parameters:
keys-- Returns:
- Multi bulk reply
-
setnx
public Long setnx(String key, String 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 interfaceJedisCommands- Parameters:
key-value-- Returns:
- Integer reply, specifically: 1 if the key was set 0 if the key was not set
-
setex
public String setex(String key, int seconds, String 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 interfaceJedisCommands- Parameters:
key-seconds-value-- Returns:
- Status code reply
-
mset
public String mset(String... 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 interfaceMultiKeyCommands- Parameters:
keysvalues-- Returns:
- Status code reply Basically +OK as MSET can't fail
- See Also:
msetnx(String...)
-
msetnx
public Long msetnx(String... 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 interfaceMultiKeyCommands- 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(String...)
-
decrBy
public Long decrBy(String key, long decrement)
IDECRBY 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 interfaceJedisCommands- Parameters:
key-decrement-- Returns:
- Integer reply, this commands will reply with the new value of key after the increment.
- See Also:
incr(String),decr(String),incrBy(String, long)
-
decr
public Long decr(String 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 interfaceJedisCommands- Parameters:
key-- Returns:
- Integer reply, this commands will reply with the new value of key after the increment.
- See Also:
incr(String),incrBy(String, long),decrBy(String, long)
-
incrBy
public Long incrBy(String 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 interfaceJedisCommands- Parameters:
key-increment-- Returns:
- Integer reply, this commands will reply with the new value of key after the increment.
- See Also:
incr(String),decr(String),decrBy(String, long)
-
incrByFloat
public Double incrByFloat(String key, double increment)
INCRBYFLOATINCRBYFLOAT 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 interfaceJedisCommands- Parameters:
key-increment-- Returns:
- Double reply, this commands will reply with the new value of key after the increment.
-
incr
public Long incr(String 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 interfaceJedisCommands- Parameters:
key-- Returns:
- Integer reply, this commands will reply with the new value of key after the increment.
- See Also:
incrBy(String, long),decr(String),decrBy(String, long)
-
append
public Long append(String key, String 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 interfaceJedisCommands- Parameters:
key-value-- Returns:
- Integer reply, specifically the total length of the string after the append operation.
-
substr
public String substr(String 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 interfaceJedisCommands- Parameters:
key-start-end-- Returns:
- Bulk reply
-
hset
public Long hset(String key, String field, String 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 interfaceJedisCommands- 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(String key, Map<String,String> hash)
- Specified by:
hsetin interfaceJedisCommands
-
hget
public String hget(String key, String 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 interfaceJedisCommands- Parameters:
key-field-- Returns:
- Bulk reply
-
hsetnx
public Long hsetnx(String key, String field, String value)
Set the specified hash field to the specified value if the field not exists. Time complexity: O(1)- Specified by:
hsetnxin interfaceJedisCommands- 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(String key, Map<String,String> 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 interfaceJedisCommands- Parameters:
key-hash-- Returns:
- Return OK or Exception if hash is empty
-
hmget
public List<String> hmget(String key, String... 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 interfaceJedisCommands- 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(String key, String 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 interfaceJedisCommands- Parameters:
key-field-value-- Returns:
- Integer reply The new value at field after the increment operation.
-
hincrByFloat
public Double hincrByFloat(String key, String 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 interfaceJedisCommands- Parameters:
key-field-value-- Returns:
- Double precision floating point reply The new value at field after the increment operation.
-
hexists
public Boolean hexists(String key, String field)
Test for existence of a specified field in a hash. Time complexity: O(1)- Specified by:
hexistsin interfaceJedisCommands- 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(String key, String... fields)
Remove the specified field from an hash stored at key.Time complexity: O(1)
- Specified by:
hdelin interfaceJedisCommands- 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(String key)
Return the number of items in a hash.Time complexity: O(1)
- Specified by:
hlenin interfaceJedisCommands- 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<String> hkeys(String key)
Return all the fields in a hash.Time complexity: O(N), where N is the total number of entries
- Specified by:
hkeysin interfaceJedisCommands- Parameters:
key-- Returns:
- All the fields names contained into a hash.
-
hvals
public List<String> hvals(String key)
Return all the values in a hash.Time complexity: O(N), where N is the total number of entries
- Specified by:
hvalsin interfaceJedisCommands- Parameters:
key-- Returns:
- All the fields values contained into a hash.
-
hgetAll
public Map<String,String> hgetAll(String 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 interfaceJedisCommands- Parameters:
key-- Returns:
- All the fields and values contained into a hash.
-
rpush
public Long rpush(String key, String... 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 interfaceJedisCommands- Parameters:
key-strings-- Returns:
- Integer reply, specifically, the number of elements inside the list after the push operation.
-
lpush
public Long lpush(String key, String... 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 interfaceJedisCommands- Parameters:
key-strings-- Returns:
- Integer reply, specifically, the number of elements inside the list after the push operation.
-
llen
public Long llen(String 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 interfaceJedisCommands- Parameters:
key-- Returns:
- The length of the list.
-
lrange
public List<String> lrange(String 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 interfaceJedisCommands- Parameters:
key-start-stop-- Returns:
- Multi bulk reply, specifically a list of elements in the specified range.
-
ltrim
public String ltrim(String 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 interfaceJedisCommands- Parameters:
key-start-stop-- Returns:
- Status code reply
-
lindex
public String lindex(String 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 interfaceJedisCommands- Parameters:
key-index-- Returns:
- Bulk reply, specifically the requested element
-
lset
public String lset(String key, long index, String 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 interfaceJedisCommands- Parameters:
key-index-value-- Returns:
- Status code reply
- See Also:
lindex(String, long)
-
lrem
public Long lrem(String key, long count, String 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 interfaceJedisCommands- Parameters:
key-count-value-- Returns:
- Integer Reply, specifically: The number of removed elements if the operation succeeded
-
lpop
public String lpop(String 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 interfaceJedisCommands- Parameters:
key-- Returns:
- Bulk reply
- See Also:
rpop(String)
-
lpop
public List<String> lpop(String key, int count)
- Specified by:
lpopin interfaceJedisCommands
-
lpos
public Long lpos(String key, String element)
- Specified by:
lposin interfaceJedisCommands
-
lpos
public Long lpos(String key, String element, LPosParams params)
- Specified by:
lposin interfaceJedisCommands
-
lpos
public List<Long> lpos(String key, String element, LPosParams params, long count)
- Specified by:
lposin interfaceJedisCommands
-
rpop
public String rpop(String 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" RPOP will return "c" and the list will become "a","b".If the key does not exist or the list is already empty the special value 'nil' is returned.
- Specified by:
rpopin interfaceJedisCommands- Parameters:
key-- Returns:
- Bulk reply
- See Also:
lpop(String)
-
rpop
public List<String> rpop(String key, int count)
- Specified by:
rpopin interfaceJedisCommands
-
rpoplpush
public String rpoplpush(String srckey, String 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 interfaceMultiKeyCommands- Parameters:
srckey-dstkey-- Returns:
- Bulk reply
-
sadd
public Long sadd(String key, String... 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 interfaceJedisCommands- 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<String> smembers(String key)
Return all the members (elements) of the set value stored at key. This is just syntax glue forSINTER.Time complexity O(N)
- Specified by:
smembersin interfaceJedisCommands- Parameters:
key-- Returns:
- Multi bulk reply
-
srem
public Long srem(String key, String... members)
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 interfaceJedisCommands- 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
-
spop
public String spop(String 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(String)command does a similar work but the returned element is not removed from the Set.Time complexity O(1)
- Specified by:
spopin interfaceJedisCommands- Parameters:
key-- Returns:
- Bulk reply
-
spop
public Set<String> spop(String key, long count)
- Specified by:
spopin interfaceJedisCommands
-
smove
public Long smove(String srckey, String dstkey, String 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 interfaceMultiKeyCommands- 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(String key)
Return the set cardinality (number of elements). If the key does not exist 0 is returned, like for empty sets.- Specified by:
scardin interfaceJedisCommands- Parameters:
key-- Returns:
- Integer reply, specifically: the cardinality (number of elements) of the set as an integer.
-
sismember
public Boolean sismember(String key, String 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 interfaceJedisCommands- 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(String key, String... 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 interfaceJedisCommands- Parameters:
key-members-- Returns:
- List representing the membership of the given elements, in the same order as they are requested.
-
sinter
public Set<String> sinter(String... keys)
Return the members of a set resulting from the intersection of all the sets hold at the specified keys. Like inLRANGEthe 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 interfaceMultiKeyCommands- Parameters:
keys-- Returns:
- Multi bulk reply, specifically the list of common elements.
-
sinterstore
public Long sinterstore(String dstkey, String... keys)
This command 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 interfaceMultiKeyCommands- Parameters:
dstkey-keys-- Returns:
- Status code reply
-
sunion
public Set<String> sunion(String... keys)
Return the members of a set resulting from the union of all the sets hold at the specified keys. Like inLRANGEthe 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 interfaceMultiKeyCommands- Parameters:
keys-- Returns:
- Multi bulk reply, specifically the list of common elements.
-
sunionstore
public Long sunionstore(String dstkey, String... 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 interfaceMultiKeyCommands- Parameters:
dstkey-keys-- Returns:
- Status code reply
-
sdiff
public Set<String> sdiff(String... 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 interfaceMultiKeyCommands- 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(String dstkey, String... keys)
This command works exactly likeSDIFFbut instead of being returned the resulting set is stored in dstkey.- Specified by:
sdiffstorein interfaceMultiKeyCommands- Parameters:
dstkey-keys-- Returns:
- Status code reply
-
srandmember
public String srandmember(String 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 interfaceJedisCommands- Parameters:
key-- Returns:
- Bulk reply
-
srandmember
public List<String> srandmember(String key, int count)
- Specified by:
srandmemberin interfaceJedisCommands
-
zadd
public Long zadd(String key, double score, String 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 interfaceJedisCommands- 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(String key, double score, String member, ZAddParams params)
- Specified by:
zaddin interfaceJedisCommands
-
zadd
public Long zadd(String key, Map<String,Double> scoreMembers)
- Specified by:
zaddin interfaceJedisCommands
-
zadd
public Long zadd(String key, Map<String,Double> scoreMembers, ZAddParams params)
- Specified by:
zaddin interfaceJedisCommands
-
zrange
public Set<String> zrange(String key, long start, long stop)
- Specified by:
zrangein interfaceJedisCommands
-
zrem
public Long zrem(String key, String... 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 interfaceJedisCommands- 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(String key, double increment, String 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 interfaceJedisCommands- Parameters:
key-increment-member-- Returns:
- The new score
-
zincrby
public Double zincrby(String key, double increment, String member, ZIncrByParams params)
- Specified by:
zincrbyin interfaceJedisCommands
-
zrank
public Long zrank(String key, String member)
Return the rank (or index) of 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 interfaceJedisCommands- 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(String, String)
-
zrevrank
public Long zrevrank(String key, String member)
Return the rank (or index) of 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 interfaceJedisCommands- 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(String, String)
-
zrevrange
public Set<String> zrevrange(String key, long start, long stop)
- Specified by:
zrevrangein interfaceJedisCommands
-
zrangeWithScores
public Set<Tuple> zrangeWithScores(String key, long start, long stop)
- Specified by:
zrangeWithScoresin interfaceJedisCommands
-
zrevrangeWithScores
public Set<Tuple> zrevrangeWithScores(String key, long start, long stop)
- Specified by:
zrevrangeWithScoresin interfaceJedisCommands
-
zcard
public Long zcard(String 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 interfaceJedisCommands- Parameters:
key-- Returns:
- the cardinality (number of elements) of the set as an integer.
-
zscore
public Double zscore(String key, String 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 interfaceJedisCommands- Parameters:
key-member-- Returns:
- the score
-
zmscore
public List<Double> zmscore(String key, String... 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 interfaceJedisCommands- Parameters:
key-members-- Returns:
- the scores
-
zpopmax
public Tuple zpopmax(String key)
- Specified by:
zpopmaxin interfaceJedisCommands
-
zpopmax
public Set<Tuple> zpopmax(String key, int count)
- Specified by:
zpopmaxin interfaceJedisCommands
-
zpopmin
public Tuple zpopmin(String key)
- Specified by:
zpopminin interfaceJedisCommands
-
zpopmin
public Set<Tuple> zpopmin(String key, int count)
- Specified by:
zpopminin interfaceJedisCommands
-
watch
public String watch(String... keys)
- Specified by:
watchin interfaceMultiKeyCommands
-
sort
public List<String> sort(String 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 interfaceJedisCommands- 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(String, String),sort(String, SortingParams),sort(String, SortingParams, String)
-
sort
public List<String> sort(String 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 interfaceJedisCommands- Parameters:
key-sortingParameters-- Returns:
- a list of sorted elements.
- See Also:
sort(String),sort(String, SortingParams, String)
-
blpop
public List<String> blpop(int timeout, String... 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 interfaceMultiKeyCommands- 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, String...)
-
blpop
public List<String> blpop(String... args)
- Specified by:
blpopin interfaceMultiKeyCommands
-
brpop
public List<String> brpop(String... args)
- Specified by:
brpopin interfaceMultiKeyCommands
-
sort
public Long sort(String key, SortingParams sortingParameters, String dstkey)
Sort a Set or a List accordingly to the specified parameters and store the result at dstkey.- Specified by:
sortin interfaceMultiKeyCommands- Parameters:
key-sortingParameters-dstkey-- Returns:
- The number of elements of the list at dstkey.
- See Also:
sort(String, SortingParams),sort(String),sort(String, String)
-
sort
public Long sort(String key, String 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 interfaceMultiKeyCommands- Parameters:
key-dstkey-- Returns:
- The number of elements of the list at dstkey.
- See Also:
sort(String),sort(String, SortingParams),sort(String, SortingParams, String)
-
brpop
public List<String> brpop(int timeout, String... 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 interfaceMultiKeyCommands- 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, String...)
-
zcount
public Long zcount(String key, double min, double max)
- Specified by:
zcountin interfaceJedisCommands
-
zcount
public Long zcount(String key, String min, String max)
- Specified by:
zcountin interfaceJedisCommands
-
zrangeByScore
public Set<String> zrangeByScore(String 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 interfaceJedisCommands- Parameters:
key-min- a double or Double.NEGATIVE_INFINITY for "-inf"max- a double or Double.POSITIVE_INFINITY for "+inf"- Returns:
- Multi bulk reply specifically a list of elements in the specified score range.
- See Also:
zrangeByScore(String, double, double),zrangeByScore(String, double, double, int, int),zrangeByScoreWithScores(String, double, double),zrangeByScoreWithScores(String, String, String),zrangeByScoreWithScores(String, double, double, int, int),zcount(String, double, double)
-
zrangeByScore
public Set<String> zrangeByScore(String key, String min, String max)
- Specified by:
zrangeByScorein interfaceJedisCommands
-
zrangeByScore
public Set<String> zrangeByScore(String 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 interfaceJedisCommands- Parameters:
key-min-max-offset-count-- Returns:
- Multi bulk reply specifically a list of elements in the specified score range.
- See Also:
zrangeByScore(String, double, double),zrangeByScore(String, double, double, int, int),zrangeByScoreWithScores(String, double, double),zrangeByScoreWithScores(String, double, double, int, int),zcount(String, double, double)
-
zrangeByScore
public Set<String> zrangeByScore(String key, String min, String max, int offset, int count)
- Specified by:
zrangeByScorein interfaceJedisCommands
-
zrangeByScoreWithScores
public Set<Tuple> zrangeByScoreWithScores(String 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 interfaceJedisCommands- Parameters:
key-min-max-- Returns:
- Multi bulk reply specifically a list of elements in the specified score range.
- See Also:
zrangeByScore(String, double, double),zrangeByScore(String, double, double, int, int),zrangeByScoreWithScores(String, double, double),zrangeByScoreWithScores(String, double, double, int, int),zcount(String, double, double)
-
zrangeByScoreWithScores
public Set<Tuple> zrangeByScoreWithScores(String key, String min, String max)
- Specified by:
zrangeByScoreWithScoresin interfaceJedisCommands
-
zrangeByScoreWithScores
public Set<Tuple> zrangeByScoreWithScores(String 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 interfaceJedisCommands- Parameters:
key-min-max-offset-count-- Returns:
- Multi bulk reply specifically a list of elements in the specified score range.
- See Also:
zrangeByScore(String, double, double),zrangeByScore(String, double, double, int, int),zrangeByScoreWithScores(String, double, double),zrangeByScoreWithScores(String, double, double, int, int),zcount(String, double, double)
-
zrangeByScoreWithScores
public Set<Tuple> zrangeByScoreWithScores(String key, String min, String max, int offset, int count)
- Specified by:
zrangeByScoreWithScoresin interfaceJedisCommands
-
zrevrangeByScore
public Set<String> zrevrangeByScore(String key, double max, double min)
- Specified by:
zrevrangeByScorein interfaceJedisCommands
-
zrevrangeByScore
public Set<String> zrevrangeByScore(String key, String max, String min)
- Specified by:
zrevrangeByScorein interfaceJedisCommands
-
zrevrangeByScore
public Set<String> zrevrangeByScore(String key, double max, double min, int offset, int count)
- Specified by:
zrevrangeByScorein interfaceJedisCommands
-
zrevrangeByScoreWithScores
public Set<Tuple> zrevrangeByScoreWithScores(String key, double max, double min)
- Specified by:
zrevrangeByScoreWithScoresin interfaceJedisCommands
-
zrevrangeByScoreWithScores
public Set<Tuple> zrevrangeByScoreWithScores(String key, double max, double min, int offset, int count)
- Specified by:
zrevrangeByScoreWithScoresin interfaceJedisCommands
-
zrevrangeByScoreWithScores
public Set<Tuple> zrevrangeByScoreWithScores(String key, String max, String min, int offset, int count)
- Specified by:
zrevrangeByScoreWithScoresin interfaceJedisCommands
-
zrevrangeByScore
public Set<String> zrevrangeByScore(String key, String max, String min, int offset, int count)
- Specified by:
zrevrangeByScorein interfaceJedisCommands
-
zrevrangeByScoreWithScores
public Set<Tuple> zrevrangeByScoreWithScores(String key, String max, String min)
- Specified by:
zrevrangeByScoreWithScoresin interfaceJedisCommands
-
zremrangeByRank
public Long zremrangeByRank(String 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 interfaceJedisCommands- Parameters:
key-start-stop-- Returns:
-
zremrangeByScore
public Long zremrangeByScore(String 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 interfaceJedisCommands- Parameters:
key-min-max-- Returns:
- Integer reply, specifically the number of elements removed.
-
zremrangeByScore
public Long zremrangeByScore(String key, String min, String max)
- Specified by:
zremrangeByScorein interfaceJedisCommands
-
zunionstore
public Long zunionstore(String dstkey, String... 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 interfaceMultiKeyCommands- Parameters:
dstkey-sets-- Returns:
- Integer reply, specifically the number of elements in the sorted set at dstkey
- See Also:
zunionstore(String, String...),zunionstore(String, ZParams, String...),zinterstore(String, String...),zinterstore(String, ZParams, String...)
-
zunionstore
public Long zunionstore(String dstkey, ZParams params, String... 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 interfaceMultiKeyCommands- Parameters:
dstkey-sets-params-- Returns:
- Integer reply, specifically the number of elements in the sorted set at dstkey
- See Also:
zunionstore(String, String...),zunionstore(String, ZParams, String...),zinterstore(String, String...),zinterstore(String, ZParams, String...)
-
zinterstore
public Long zinterstore(String dstkey, String... 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 interfaceMultiKeyCommands- Parameters:
dstkey-sets-- Returns:
- Integer reply, specifically the number of elements in the sorted set at dstkey
- See Also:
zunionstore(String, String...),zunionstore(String, ZParams, String...),zinterstore(String, String...),zinterstore(String, ZParams, String...)
-
zinterstore
public Long zinterstore(String dstkey, ZParams params, String... 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 interfaceMultiKeyCommands- Parameters:
dstkey-sets-params-- Returns:
- Integer reply, specifically the number of elements in the sorted set at dstkey
- See Also:
zunionstore(String, String...),zunionstore(String, ZParams, String...),zinterstore(String, String...),zinterstore(String, ZParams, String...)
-
zlexcount
public Long zlexcount(String key, String min, String max)
- Specified by:
zlexcountin interfaceJedisCommands
-
zrangeByLex
public Set<String> zrangeByLex(String key, String min, String max)
- Specified by:
zrangeByLexin interfaceJedisCommands
-
zrangeByLex
public Set<String> zrangeByLex(String key, String min, String max, int offset, int count)
- Specified by:
zrangeByLexin interfaceJedisCommands
-
zrevrangeByLex
public Set<String> zrevrangeByLex(String key, String max, String min)
- Specified by:
zrevrangeByLexin interfaceJedisCommands
-
zrevrangeByLex
public Set<String> zrevrangeByLex(String key, String max, String min, int offset, int count)
- Specified by:
zrevrangeByLexin interfaceJedisCommands
-
zremrangeByLex
public Long zremrangeByLex(String key, String min, String max)
- Specified by:
zremrangeByLexin interfaceJedisCommands
-
strlen
public Long strlen(String key)
- Specified by:
strlenin interfaceJedisCommands
-
lpushx
public Long lpushx(String key, String... string)
- Specified by:
lpushxin interfaceJedisCommands
-
persist
public Long persist(String key)
Undo aexpireat turning the expire key into a normal key.Time complexity: O(1)
- Specified by:
persistin interfaceJedisCommands- 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(String key, String... string)
- Specified by:
rpushxin interfaceJedisCommands
-
echo
public String echo(String string)
- Specified by:
echoin interfaceJedisCommands
-
linsert
public Long linsert(String key, ListPosition where, String pivot, String value)
- Specified by:
linsertin interfaceJedisCommands
-
brpoplpush
public String brpoplpush(String source, String 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 interfaceMultiKeyCommands- Parameters:
source-destination-timeout-- Returns:
- the element
-
setbit
public Boolean setbit(String key, long offset, boolean value)
Sets or clears the bit at offset in the string value stored at key- Specified by:
setbitin interfaceJedisCommands- Parameters:
key-offset-value-- Returns:
-
setbit
public Boolean setbit(String key, long offset, String value)
- Specified by:
setbitin interfaceJedisCommands
-
getbit
public Boolean getbit(String key, long offset)
Returns the bit value at offset in the string value stored at key- Specified by:
getbitin interfaceJedisCommands- Parameters:
key-offset-- Returns:
-
setrange
public Long setrange(String key, long offset, String value)
- Specified by:
setrangein interfaceJedisCommands
-
getrange
public String getrange(String key, long startOffset, long endOffset)
- Specified by:
getrangein interfaceJedisCommands
-
bitpos
public Long bitpos(String key, boolean value)
- Specified by:
bitposin interfaceJedisCommands
-
bitpos
public Long bitpos(String key, boolean value, BitPosParams params)
- Specified by:
bitposin interfaceJedisCommands
-
configGet
public List<String> configGet(String 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 interfaceAdvancedJedisCommands- Parameters:
pattern-- Returns:
- Bulk reply.
-
configSet
public String configSet(String parameter, String 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 interfaceAdvancedJedisCommands- Parameters:
parameter-value-- Returns:
- Status code reply
-
subscribe
public void subscribe(JedisPubSub jedisPubSub, String... channels)
- Specified by:
subscribein interfaceMultiKeyCommands
-
publish
public Long publish(String channel, String message)
- Specified by:
publishin interfaceMultiKeyCommands
-
psubscribe
public void psubscribe(JedisPubSub jedisPubSub, String... patterns)
- Specified by:
psubscribein interfaceMultiKeyCommands
-
eval
public Object eval(String script, int keyCount, String... params)
- Specified by:
evalin interfaceScriptingCommands
-
eval
public Object eval(String script, List<String> keys, List<String> args)
- Specified by:
evalin interfaceScriptingCommands
-
eval
public Object eval(String script)
- Specified by:
evalin interfaceScriptingCommands
-
evalsha
public Object evalsha(String sha1)
- Specified by:
evalshain interfaceScriptingCommands
-
evalsha
public Object evalsha(String sha1, List<String> keys, List<String> args)
- Specified by:
evalshain interfaceScriptingCommands
-
evalsha
public Object evalsha(String sha1, int keyCount, String... params)
- Specified by:
evalshain interfaceScriptingCommands
-
scriptExists
public Boolean scriptExists(String sha1)
- Specified by:
scriptExistsin interfaceScriptingCommands
-
scriptExists
public List<Boolean> scriptExists(String... sha1)
- Specified by:
scriptExistsin interfaceScriptingCommands
-
scriptLoad
public String scriptLoad(String script)
- Specified by:
scriptLoadin interfaceScriptingCommands
-
slowlogGet
public List<Slowlog> slowlogGet()
- Specified by:
slowlogGetin interfaceAdvancedJedisCommands
-
slowlogGet
public List<Slowlog> slowlogGet(long entries)
- Specified by:
slowlogGetin interfaceAdvancedJedisCommands
-
objectRefcount
public Long objectRefcount(String key)
- Specified by:
objectRefcountin interfaceAdvancedJedisCommands
-
objectEncoding
public String objectEncoding(String key)
- Specified by:
objectEncodingin interfaceAdvancedJedisCommands
-
objectIdletime
public Long objectIdletime(String key)
- Specified by:
objectIdletimein interfaceAdvancedJedisCommands
-
objectHelp
public List<String> objectHelp()
- Specified by:
objectHelpin interfaceAdvancedJedisCommands
-
objectFreq
public Long objectFreq(String key)
- Specified by:
objectFreqin interfaceAdvancedJedisCommands
-
bitcount
public Long bitcount(String key)
- Specified by:
bitcountin interfaceJedisCommands
-
bitcount
public Long bitcount(String key, long start, long end)
- Specified by:
bitcountin interfaceJedisCommands
-
bitop
public Long bitop(BitOP op, String destKey, String... srcKeys)
- Specified by:
bitopin interfaceMultiKeyCommands
-
sentinelMasters
public List<Map<String,String>> sentinelMasters()
redis 127.0.0.1:26381> sentinel masters 1) 1) "name" 2) "mymaster" 3) "ip" 4) "127.0.0.1" 5) "port" 6) "6379" 7) "runid" 8) "93d4d4e6e9c06d0eea36e27f31924ac26576081d" 9) "flags" 10) "master" 11) "pending-commands" 12) "0" 13) "last-ok-ping-reply" 14) "423" 15) "last-ping-reply" 16) "423" 17) "info-refresh" 18) "6107" 19) "num-slaves" 20) "1" 21) "num-other-sentinels" 22) "2" 23) "quorum" 24) "2"- Specified by:
sentinelMastersin interfaceSentinelCommands- Returns:
-
sentinelGetMasterAddrByName
public List<String> sentinelGetMasterAddrByName(String masterName)
redis 127.0.0.1:26381> sentinel get-master-addr-by-name mymaster 1) "127.0.0.1" 2) "6379"
- Specified by:
sentinelGetMasterAddrByNamein interfaceSentinelCommands- Parameters:
masterName-- Returns:
- two elements list of strings : host and port.
-
sentinelReset
public Long sentinelReset(String pattern)
redis 127.0.0.1:26381> sentinel reset mymaster (integer) 1
- Specified by:
sentinelResetin interfaceSentinelCommands- Parameters:
pattern-- Returns:
-
sentinelSlaves
public List<Map<String,String>> sentinelSlaves(String masterName)
redis 127.0.0.1:26381> sentinel slaves mymaster 1) 1) "name" 2) "127.0.0.1:6380" 3) "ip" 4) "127.0.0.1" 5) "port" 6) "6380" 7) "runid" 8) "d7f6c0ca7572df9d2f33713df0dbf8c72da7c039" 9) "flags" 10) "slave" 11) "pending-commands" 12) "0" 13) "last-ok-ping-reply" 14) "47" 15) "last-ping-reply" 16) "47" 17) "info-refresh" 18) "657" 19) "master-link-down-time" 20) "0" 21) "master-link-status" 22) "ok" 23) "master-host" 24) "localhost" 25) "master-port" 26) "6379" 27) "slave-priority" 28) "100"- Specified by:
sentinelSlavesin interfaceSentinelCommands- Parameters:
masterName-- Returns:
-
sentinelFailover
public String sentinelFailover(String masterName)
- Specified by:
sentinelFailoverin interfaceSentinelCommands
-
sentinelMonitor
public String sentinelMonitor(String masterName, String ip, int port, int quorum)
- Specified by:
sentinelMonitorin interfaceSentinelCommands
-
sentinelRemove
public String sentinelRemove(String masterName)
- Specified by:
sentinelRemovein interfaceSentinelCommands
-
sentinelSet
public String sentinelSet(String masterName, Map<String,String> parameterMap)
- Specified by:
sentinelSetin interfaceSentinelCommands
-
dump
public byte[] dump(String key)
- Specified by:
dumpin interfaceJedisCommands
-
restore
public String restore(String key, int ttl, byte[] serializedValue)
- Specified by:
restorein interfaceJedisCommands
-
restoreReplace
public String restoreReplace(String key, int ttl, byte[] serializedValue)
- Specified by:
restoreReplacein interfaceJedisCommands
-
pexpire
public Long pexpire(String key, long milliseconds)
- Specified by:
pexpirein interfaceJedisCommands
-
pexpireAt
public Long pexpireAt(String key, long millisecondsTimestamp)
- Specified by:
pexpireAtin interfaceJedisCommands
-
pttl
public Long pttl(String key)
- Specified by:
pttlin interfaceJedisCommands
-
psetex
public String psetex(String key, long milliseconds, String value)
PSETEX works exactly likesetex(String, int, String)with the sole difference that the expire time is specified in milliseconds instead of seconds. Time complexity: O(1)- Specified by:
psetexin interfaceJedisCommands- Parameters:
key-milliseconds-value-- Returns:
- Status code reply
-
clientKill
public String clientKill(String ipPort)
- Specified by:
clientKillin interfaceAdvancedJedisCommands
-
clientGetname
public String clientGetname()
- Specified by:
clientGetnamein interfaceAdvancedJedisCommands
-
clientList
public String clientList()
- Specified by:
clientListin interfaceAdvancedJedisCommands
-
clientSetname
public String clientSetname(String name)
- Specified by:
clientSetnamein interfaceAdvancedJedisCommands
-
clientId
public Long clientId()
- Specified by:
clientIdin interfaceAdvancedBinaryJedisCommands- Specified by:
clientIdin interfaceAdvancedJedisCommands- Overrides:
clientIdin classBinaryJedis
-
migrate
public String migrate(String host, int port, String key, int destinationDb, int timeout)
- Specified by:
migratein interfaceAdvancedJedisCommands
-
migrate
public String migrate(String host, int port, int destinationDB, int timeout, MigrateParams params, String... keys)
- Specified by:
migratein interfaceAdvancedJedisCommands
-
scan
public ScanResult<String> scan(String cursor)
- Specified by:
scanin interfaceMultiKeyCommands- Returns:
- See Also:
MultiKeyCommands.scan(String, ScanParams)
-
scan
public ScanResult<String> scan(String cursor, ScanParams params)
Description copied from interface:MultiKeyCommandsIterates the set of keys in the currently selected Redis database.Since this command allows for incremental iteration, returning only a small number of elements per call, it can be used in production without the downside of commands like
MultiKeyCommands.keys(String)orJedisCommands.smembers(String))} that may block the server for a long time (even several seconds) when called against big collections of keys or elements.SCAN basic usage
SCAN is a cursor based iterator. This means that at every call of the command, the server returns an updated cursor that the user needs to use as the cursor argument in the next call. An iteration starts when the cursor is set to 0, and terminates when the cursor returned by the server is 0.Scan guarantees
The SCAN command, and the other commands in the SCAN family, are able to provide to the user a set of guarantees associated to full iterations.- A full iteration always retrieves all the elements that were present in the collection from the start to the end of a full iteration. This means that if a given element is inside the collection when an iteration is started, and is still there when an iteration terminates, then at some point SCAN returned it to the user.
- A full iteration never returns any element that was NOT present in the collection from the start to the end of a full iteration. So if an element was removed before the start of an iteration, and is never added back to the collection for all the time an iteration lasts, SCAN ensures that this element will never be returned.
- A given element may be returned multiple times. It is up to the application to handle the case of duplicated elements, for example only using the returned elements in order to perform operations that are safe when re-applied multiple times.
- Elements that were not constantly present in the collection during a full iteration, may be returned or not: it is undefined.
Time complexity: O(1) for every call. O(N) for a complete iteration, including enough command calls for the cursor to return back to 0. N is the number of elements inside the DB.
- Specified by:
scanin interfaceMultiKeyCommands- Parameters:
cursor- The cursor.params- the scan parameters. For example a glob-style match pattern- Returns:
- the scan result with the results of this iteration and the new position of the cursor
- See Also:
- Redis SCAN documentation
-
hscan
public ScanResult<Map.Entry<String,String>> hscan(String key, String cursor)
- Specified by:
hscanin interfaceJedisCommands
-
hscan
public ScanResult<Map.Entry<String,String>> hscan(String key, String cursor, ScanParams params)
- Specified by:
hscanin interfaceJedisCommands
-
sscan
public ScanResult<String> sscan(String key, String cursor)
- Specified by:
sscanin interfaceJedisCommands
-
sscan
public ScanResult<String> sscan(String key, String cursor, ScanParams params)
- Specified by:
sscanin interfaceJedisCommands
-
zscan
public ScanResult<Tuple> zscan(String key, String cursor)
- Specified by:
zscanin interfaceJedisCommands
-
zscan
public ScanResult<Tuple> zscan(String key, String cursor, ScanParams params)
- Specified by:
zscanin interfaceJedisCommands
-
clusterNodes
public String clusterNodes()
- Specified by:
clusterNodesin interfaceClusterCommands
-
readonly
public String readonly()
- Specified by:
readonlyin interfaceClusterCommands
-
clusterMeet
public String clusterMeet(String ip, int port)
- Specified by:
clusterMeetin interfaceClusterCommands
-
clusterReset
public String clusterReset(ClusterReset resetType)
- Specified by:
clusterResetin interfaceClusterCommands
-
clusterAddSlots
public String clusterAddSlots(int... slots)
- Specified by:
clusterAddSlotsin interfaceClusterCommands
-
clusterDelSlots
public String clusterDelSlots(int... slots)
- Specified by:
clusterDelSlotsin interfaceClusterCommands
-
clusterInfo
public String clusterInfo()
- Specified by:
clusterInfoin interfaceClusterCommands
-
clusterGetKeysInSlot
public List<String> clusterGetKeysInSlot(int slot, int count)
- Specified by:
clusterGetKeysInSlotin interfaceClusterCommands
-
clusterSetSlotNode
public String clusterSetSlotNode(int slot, String nodeId)
- Specified by:
clusterSetSlotNodein interfaceClusterCommands
-
clusterSetSlotMigrating
public String clusterSetSlotMigrating(int slot, String nodeId)
- Specified by:
clusterSetSlotMigratingin interfaceClusterCommands
-
clusterSetSlotImporting
public String clusterSetSlotImporting(int slot, String nodeId)
- Specified by:
clusterSetSlotImportingin interfaceClusterCommands
-
clusterSetSlotStable
public String clusterSetSlotStable(int slot)
- Specified by:
clusterSetSlotStablein interfaceClusterCommands
-
clusterForget
public String clusterForget(String nodeId)
- Specified by:
clusterForgetin interfaceClusterCommands
-
clusterFlushSlots
public String clusterFlushSlots()
- Specified by:
clusterFlushSlotsin interfaceClusterCommands
-
clusterKeySlot
public Long clusterKeySlot(String key)
- Specified by:
clusterKeySlotin interfaceClusterCommands
-
clusterCountKeysInSlot
public Long clusterCountKeysInSlot(int slot)
- Specified by:
clusterCountKeysInSlotin interfaceClusterCommands
-
clusterSaveConfig
public String clusterSaveConfig()
- Specified by:
clusterSaveConfigin interfaceClusterCommands
-
clusterReplicate
public String clusterReplicate(String nodeId)
- Specified by:
clusterReplicatein interfaceClusterCommands
-
clusterSlaves
public List<String> clusterSlaves(String nodeId)
- Specified by:
clusterSlavesin interfaceClusterCommands
-
clusterFailover
public String clusterFailover()
- Specified by:
clusterFailoverin interfaceClusterCommands
-
clusterSlots
public List<Object> clusterSlots()
- Specified by:
clusterSlotsin interfaceClusterCommands
-
asking
public String asking()
-
pubsubNumPat
public Long pubsubNumPat()
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classBinaryJedis
-
setDataSource
public void setDataSource(JedisPoolAbstract jedisPool)
-
pfadd
public Long pfadd(String key, String... elements)
- Specified by:
pfaddin interfaceJedisCommands
-
pfcount
public long pfcount(String key)
- Specified by:
pfcountin interfaceJedisCommands
-
pfcount
public long pfcount(String... keys)
- Specified by:
pfcountin interfaceMultiKeyCommands
-
pfmerge
public String pfmerge(String destkey, String... sourcekeys)
- Specified by:
pfmergein interfaceMultiKeyCommands
-
blpop
public List<String> blpop(int timeout, String key)
- Specified by:
blpopin interfaceJedisCommands
-
brpop
public List<String> brpop(int timeout, String key)
- Specified by:
brpopin interfaceJedisCommands
-
geoadd
public Long geoadd(String key, double longitude, double latitude, String member)
- Specified by:
geoaddin interfaceJedisCommands
-
geoadd
public Long geoadd(String key, Map<String,GeoCoordinate> memberCoordinateMap)
- Specified by:
geoaddin interfaceJedisCommands
-
geodist
public Double geodist(String key, String member1, String member2)
- Specified by:
geodistin interfaceJedisCommands
-
geodist
public Double geodist(String key, String member1, String member2, GeoUnit unit)
- Specified by:
geodistin interfaceJedisCommands
-
geohash
public List<String> geohash(String key, String... members)
- Specified by:
geohashin interfaceJedisCommands
-
geopos
public List<GeoCoordinate> geopos(String key, String... members)
- Specified by:
geoposin interfaceJedisCommands
-
georadius
public List<GeoRadiusResponse> georadius(String key, double longitude, double latitude, double radius, GeoUnit unit)
- Specified by:
georadiusin interfaceJedisCommands
-
georadiusReadonly
public List<GeoRadiusResponse> georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit)
- Specified by:
georadiusReadonlyin interfaceJedisCommands
-
georadius
public List<GeoRadiusResponse> georadius(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param)
- Specified by:
georadiusin interfaceJedisCommands
-
georadiusStore
public Long georadiusStore(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam)
- Specified by:
georadiusStorein interfaceMultiKeyCommands
-
georadiusReadonly
public List<GeoRadiusResponse> georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param)
- Specified by:
georadiusReadonlyin interfaceJedisCommands
-
georadiusByMember
public List<GeoRadiusResponse> georadiusByMember(String key, String member, double radius, GeoUnit unit)
- Specified by:
georadiusByMemberin interfaceJedisCommands
-
georadiusByMemberReadonly
public List<GeoRadiusResponse> georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit)
- Specified by:
georadiusByMemberReadonlyin interfaceJedisCommands
-
georadiusByMember
public List<GeoRadiusResponse> georadiusByMember(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param)
- Specified by:
georadiusByMemberin interfaceJedisCommands
-
georadiusByMemberStore
public Long georadiusByMemberStore(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam)
- Specified by:
georadiusByMemberStorein interfaceMultiKeyCommands
-
georadiusByMemberReadonly
public List<GeoRadiusResponse> georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param)
- Specified by:
georadiusByMemberReadonlyin interfaceJedisCommands
-
moduleLoad
public String moduleLoad(String path)
- Specified by:
moduleLoadin interfaceModuleCommands
-
moduleUnload
public String moduleUnload(String name)
- Specified by:
moduleUnloadin interfaceModuleCommands
-
moduleList
public List<Module> moduleList()
- Specified by:
moduleListin interfaceModuleCommands
-
aclSetUser
public String aclSetUser(String name)
- Specified by:
aclSetUserin interfaceAdvancedJedisCommands
-
aclSetUser
public String aclSetUser(String name, String... params)
- Specified by:
aclSetUserin interfaceAdvancedJedisCommands
-
aclDelUser
public Long aclDelUser(String name)
- Specified by:
aclDelUserin interfaceAdvancedJedisCommands
-
aclGetUser
public AccessControlUser aclGetUser(String name)
- Specified by:
aclGetUserin interfaceAdvancedJedisCommands
-
aclUsers
public List<String> aclUsers()
- Specified by:
aclUsersin interfaceAdvancedJedisCommands
-
aclList
public List<String> aclList()
- Specified by:
aclListin interfaceAdvancedJedisCommands
-
aclWhoAmI
public String aclWhoAmI()
- Specified by:
aclWhoAmIin interfaceAdvancedJedisCommands
-
aclCat
public List<String> aclCat()
- Specified by:
aclCatin interfaceAdvancedJedisCommands
-
aclCat
public List<String> aclCat(String category)
- Specified by:
aclCatin interfaceAdvancedJedisCommands
-
aclLog
public List<AccessControlLogEntry> aclLog()
- Specified by:
aclLogin interfaceAdvancedJedisCommands
-
aclLog
public List<AccessControlLogEntry> aclLog(int limit)
- Specified by:
aclLogin interfaceAdvancedJedisCommands
-
aclLog
public String aclLog(String options)
- Specified by:
aclLogin interfaceAdvancedJedisCommands
-
aclGenPass
public String aclGenPass()
- Specified by:
aclGenPassin interfaceAdvancedJedisCommands
-
bitfield
public List<Long> bitfield(String key, String... arguments)
Description copied from interface:JedisCommandsExecutes BITFIELD Redis command- Specified by:
bitfieldin interfaceJedisCommands- Returns:
-
bitfieldReadonly
public List<Long> bitfieldReadonly(String key, String... arguments)
- Specified by:
bitfieldReadonlyin interfaceJedisCommands
-
hstrlen
public Long hstrlen(String key, String field)
Description copied from interface:JedisCommandsUsed for HSTRLEN Redis command- Specified by:
hstrlenin interfaceJedisCommands- Returns:
- length of the value for key
-
memoryDoctor
public String memoryDoctor()
- Specified by:
memoryDoctorin interfaceAdvancedJedisCommands
-
memoryUsage
public Long memoryUsage(String key)
- Specified by:
memoryUsagein interfaceAdvancedJedisCommands
-
memoryUsage
public Long memoryUsage(String key, int samples)
- Specified by:
memoryUsagein interfaceAdvancedJedisCommands
-
xadd
public StreamEntryID xadd(String key, StreamEntryID id, Map<String,String> hash)
Description copied from interface:JedisCommandsXADD key ID field string [field string ...]- Specified by:
xaddin interfaceJedisCommands- Returns:
- the ID of the added entry
-
xadd
public StreamEntryID xadd(String key, StreamEntryID id, Map<String,String> hash, long maxLen, boolean approximateLength)
Description copied from interface:JedisCommandsXADD key MAXLEN ~ LEN ID field string [field string ...]- Specified by:
xaddin interfaceJedisCommands- Returns:
-
xlen
public Long xlen(String key)
Description copied from interface:JedisCommandsXLEN key- Specified by:
xlenin interfaceJedisCommands- Returns:
-
xrange
public List<StreamEntry> xrange(String key, StreamEntryID start, StreamEntryID end, int count)
XRANGE key start end [COUNT count]- Specified by:
xrangein interfaceJedisCommandsstart- minimumStreamEntryIDfor the retrieved range, passingnullwill indicate minimum ID possible in the streamend- maximumStreamEntryIDfor the retrieved range, passingnullwill indicate maximum ID possible in the streamcount- maximum number of entries returned- Returns:
- The entries with IDs matching the specified range.
-
xrevrange
public List<StreamEntry> xrevrange(String key, StreamEntryID end, StreamEntryID start, int count)
XREVRANGE key end start [COUNT] - Specified by:
xrevrangein interfaceJedisCommandsend- maximumStreamEntryIDfor the retrieved range, passingnullwill indicate maximum ID possible in the streamstart- minimumStreamEntryIDfor the retrieved range, passingnullwill indicate minimum ID possible in the streamcount- The entries with IDs matching the specified range.- Returns:
- the entries with IDs matching the specified range, from the higher ID to the lower ID matching.
-
xread
public List<Map.Entry<String,List<StreamEntry>>> xread(int count, long block, Map.Entry<String,StreamEntryID>... streams)
XREAD [COUNT count] [BLOCK milliseconds] STREAMS key [key ...] ID [ID ...]- Specified by:
xreadin interfaceMultiKeyCommands- Returns:
-
xack
public long xack(String key, String group, StreamEntryID... ids)
XACK key group ID [ID ...]- Specified by:
xackin interfaceJedisCommands- Returns:
-
xgroupCreate
public String xgroupCreate(String key, String groupname, StreamEntryID id, boolean makeStream)
Description copied from interface:JedisCommandsXGROUP CREATE- Specified by:
xgroupCreatein interfaceJedisCommands- Returns:
-
xgroupSetID
public String xgroupSetID(String key, String groupname, StreamEntryID id)
Description copied from interface:JedisCommandsXGROUP SETID- Specified by:
xgroupSetIDin interfaceJedisCommands- Returns:
-
xgroupDestroy
public long xgroupDestroy(String key, String groupname)
Description copied from interface:JedisCommandsXGROUP DESTROY- Specified by:
xgroupDestroyin interfaceJedisCommands- Returns:
-
xgroupDelConsumer
public Long xgroupDelConsumer(String key, String groupname, String consumerName)
Description copied from interface:JedisCommandsXGROUP DELCONSUMER- Specified by:
xgroupDelConsumerin interfaceJedisCommands- Returns:
-
xdel
public long xdel(String key, StreamEntryID... ids)
Description copied from interface:JedisCommandsXDEL key ID [ID ...]- Specified by:
xdelin interfaceJedisCommands- Returns:
-
xtrim
public long xtrim(String key, long maxLen, boolean approximateLength)
Description copied from interface:JedisCommandsXTRIM key MAXLEN [~] count- Specified by:
xtrimin interfaceJedisCommands- Returns:
-
xreadGroup
public List<Map.Entry<String,List<StreamEntry>>> xreadGroup(String groupname, String consumer, int count, long block, boolean noAck, Map.Entry<String,StreamEntryID>... streams)
XREAD [COUNT count] [BLOCK milliseconds] STREAMS key [key ...] ID [ID ...]- Specified by:
xreadGroupin interfaceMultiKeyCommands- Returns:
-
xpending
public List<StreamPendingEntry> xpending(String key, String groupname, StreamEntryID start, StreamEntryID end, int count, String consumername)
Description copied from interface:JedisCommandsXPENDING key group [start end count] [consumer]- Specified by:
xpendingin interfaceJedisCommands- Returns:
-
xclaim
public List<StreamEntry> xclaim(String key, String group, String consumername, long minIdleTime, long newIdleTime, int retries, boolean force, StreamEntryID... ids)
Description copied from interface:JedisCommandsXCLAIM[IDLE ] [TIME ] [RETRYCOUNT ] [FORCE] [JUSTID] - Specified by:
xclaimin interfaceJedisCommands
-
xinfoStream
public StreamInfo xinfoStream(String key)
Description copied from interface:JedisCommandsIntrospection command used in order to retrieve different information about the stream- Specified by:
xinfoStreamin interfaceJedisCommands- Parameters:
key- Stream name- Returns:
StreamInfothat contains information about the stream
-
xinfoGroup
public List<StreamGroupInfo> xinfoGroup(String key)
Description copied from interface:JedisCommandsIntrospection command used in order to retrieve different information about groups in the stream- Specified by:
xinfoGroupin interfaceJedisCommands- Parameters:
key- Stream name- Returns:
- List of
StreamGroupInfocontaining information about groups
-
xinfoConsumers
public List<StreamConsumersInfo> xinfoConsumers(String key, String group)
Description copied from interface:JedisCommandsIntrospection command used in order to retrieve different information about consumers in the group- Specified by:
xinfoConsumersin interfaceJedisCommands- Parameters:
key- Stream namegroup- Group name- Returns:
- List of
StreamConsumersInfocontaining information about consumers that belong to the the group
-
sendCommand
public Object sendCommand(ProtocolCommand cmd, String... args)
-
sendBlockingCommand
public Object sendBlockingCommand(ProtocolCommand cmd, String... args)
-
-