Redis Commands
Jedis commands all share a common interface, if the client
kwarg is not provided then the Jedis.GLOBAL_CLIENT
instance will be used:
command(args...; kwargs..., client=get_global_client())
Full list of Jedis commands:
Jedis.auth
— Functionauth(password[, username])
Authenticate to the server.
Jedis.select
— Functionselect(database)
Change the selected database for the current connection.
Jedis.ping
— Functionping()
Ping the server.
Jedis.flushdb
— Functionflushdb([; async=false])
Remove all keys from the current database.
Jedis.flushall
— Functionflushall([; async=false])
Remove all keys from all databases.
Jedis.quit
— Functionquit()
Close the connection.
Jedis.set
— Functionset(key, value)
Set the string value of a key.
Base.get
— Functionget(key)
Get the value of a key.
Jedis.del
— Functiondel(key[, keys...])
Delete a key.
Jedis.exists
— Functionexists(key[, keys...])
Determine if a key exists.
Jedis.hexists
— Functionhexists(key, field)
Determine if a hash field exists.
Jedis.keys
— Functionkeys(pattern)
Find all keys matching the pattern.
Jedis.keys
is not exported as the interface conflicts with Base.keys
.
Jedis.hkeys
— Functionhkeys(key)
Get all fields in a hash.
Jedis.setex
— Functionsetex(key, seconds, value)
Set the value and expiration of a key.
Jedis.expire
— Functionexpire(key, seconds)
Set a key's tiem to live in seconds.
Jedis.ttl
— Functionttl(key)
Get the time to live for a key.
Jedis.multi
— Functionmulti()
Mark the start of a transaction block.
Examples
julia> multi()
"OK"
julia> set("key", "value")
"QUEUED"
julia> get("key")
"QUEUED"
julia> exec()
2-element Array{String,1}:
"OK"
"value"
Jedis.exec
— Functionexec()
Execute all commands issued after MULTI.
Examples
julia> multi()
"OK"
julia> set("key", "value")
"QUEUED"
julia> get("key")
"QUEUED"
julia> exec()
2-element Array{String,1}:
"OK"
"value"
Jedis.multi_exec
— Functionmulti_exec(fn::Function)
Execute a MULTI/EXEC transction in a do block.
Examples
julia> multi_exec() do
set("key", "value")
get("key")
get("key")
end
3-element Array{String,1}:
"OK"
"value"
"value"
Jedis.hset
— Functionhset(key, field, value)
Set the string value of a hash field.
Jedis.hget
— Functionhget(key, field)
Get the value of a hash field.
Jedis.hgetall
— Functionhgetall(key)
Get all the fields and values in a hash.
Jedis.hmget
— Functionhmget(key, field[, fields...])
Get the values of all the given hash fields.
Jedis.hdel
— Functionhdel(key, field[, fields...])
Delete one or more hash fields.
Jedis.lpush
— Functionlpush(key, element[, elements...])
Prepend one or multiple elements to a list.
Jedis.rpush
— Functionrpush(key, element[, elements...])
Append one or multiple elements to a list.
Jedis.lpos
— Functionlpos(key, element[, rank, num_matches, len])
Return the index of matching element on a list.
Jedis.lrem
— Functionlrem(key, count, element)
Remove elements from a list.
Jedis.lpop
— Functionlpop(key)
Remove and get the first element in a list.
Jedis.rpop
— Functionrpop(key)
Remove and get the last element in a list.
Jedis.blpop
— Functionblpop(key[, key...; timeout=0])
Remove and get the first element in a list, or block until one is available.
Jedis.brpop
— Functionbrpop(key[, key...; timeout=0])
Remove and get the last element in a list, or block until one is available.
Jedis.llen
— Functionllen(key)
Get the length of a list.
Jedis.lrange
— Functionlrange(key, start, stop)
Get a range of elements from a list.
Jedis.incr
— Functionincr(key)
Increment the integer value of a key by one.
Jedis.incrby
— Functionincrby(key, increment)
Increment the integer value of a key by the given amount.
Jedis.incrbyfloat
— Functionincrbyfloat(key, increment)
Increment the float value of a key by the given amount.
Jedis.hincrby
— Functionhincrby(key, field, increment)
Increment the integer value of a hash field by the given number.
Jedis.hincrbyfloat
— Functionhincrbyfloat(key, field, increment)
Increment the float value of a hash field by the given number.
Jedis.zincrby
— Functionzincrby(key, field, member)
Increment the score of a member in a sorted set.