- data Redis a
- runRedis :: RedisConn -> Redis a -> IO a
- data RedisConn
- connect :: HostName -> PortID -> IO RedisConn
- disconnect :: RedisConn -> IO ()
- type HostName = String
- data PortID
- defaultPort :: PortID
- auth :: ByteString -> Redis (Either Reply Status)
- echo :: ByteString -> Redis (Either Reply ByteString)
- ping :: Redis (Either Reply Status)
- quit :: Redis (Either Reply Status)
- select :: Integer -> Redis (Either Reply Status)
- del :: [ByteString] -> Redis (Either Reply Integer)
- exists :: ByteString -> Redis (Either Reply Bool)
- expire :: ByteString -> Integer -> Redis (Either Reply Bool)
- expireat :: ByteString -> Integer -> Redis (Either Reply Bool)
- keys :: ByteString -> Redis (Either Reply [ByteString])
- move :: ByteString -> Integer -> Redis (Either Reply Bool)
- objectRefcount :: ByteString -> Redis (Either Reply Integer)
- objectEncoding :: ByteString -> Redis (Either Reply ByteString)
- objectIdletime :: ByteString -> Redis (Either Reply Integer)
- persist :: ByteString -> Redis (Either Reply Bool)
- randomkey :: Redis (Either Reply ByteString)
- rename :: ByteString -> ByteString -> Redis (Either Reply Status)
- renamenx :: ByteString -> ByteString -> Redis (Either Reply Bool)
- data SortOpts = SortOpts {}
- defaultSortOpts :: SortOpts
- data SortOrder
- sort :: ByteString -> SortOpts -> Redis (Either Reply [ByteString])
- sortStore :: ByteString -> ByteString -> SortOpts -> Redis (Either Reply Integer)
- ttl :: ByteString -> Redis (Either Reply Integer)
- getType :: ByteString -> Redis (Either Reply Status)
- hdel :: ByteString -> [ByteString] -> Redis (Either Reply Bool)
- hexists :: ByteString -> ByteString -> Redis (Either Reply Bool)
- hget :: ByteString -> ByteString -> Redis (Either Reply (Maybe ByteString))
- hgetall :: ByteString -> Redis (Either Reply [(ByteString, ByteString)])
- hincrby :: ByteString -> ByteString -> Integer -> Redis (Either Reply Integer)
- hkeys :: ByteString -> Redis (Either Reply [ByteString])
- hlen :: ByteString -> Redis (Either Reply Integer)
- hmget :: ByteString -> [ByteString] -> Redis (Either Reply [Maybe ByteString])
- hmset :: ByteString -> [(ByteString, ByteString)] -> Redis (Either Reply Status)
- hset :: ByteString -> ByteString -> ByteString -> Redis (Either Reply Bool)
- hsetnx :: ByteString -> ByteString -> ByteString -> Redis (Either Reply Bool)
- hvals :: ByteString -> Redis (Either Reply [ByteString])
- blpop :: [ByteString] -> Integer -> Redis (Either Reply (ByteString, ByteString))
- brpop :: [ByteString] -> Integer -> Redis (Either Reply (ByteString, ByteString))
- brpoplpush :: ByteString -> ByteString -> Integer -> Redis (Either Reply ByteString)
- lindex :: ByteString -> Integer -> Redis (Either Reply ByteString)
- linsertBefore :: ByteString -> ByteString -> ByteString -> Redis (Either Reply Integer)
- linsertAfter :: ByteString -> ByteString -> ByteString -> Redis (Either Reply Integer)
- llen :: ByteString -> Redis (Either Reply Integer)
- lpop :: ByteString -> Redis (Either Reply ByteString)
- lpush :: ByteString -> [ByteString] -> Redis (Either Reply Integer)
- lpushx :: ByteString -> ByteString -> Redis (Either Reply Integer)
- lrange :: ByteString -> Integer -> Integer -> Redis (Either Reply [ByteString])
- lrem :: ByteString -> Integer -> ByteString -> Redis (Either Reply Integer)
- lset :: ByteString -> Integer -> ByteString -> Redis (Either Reply Status)
- ltrim :: ByteString -> Integer -> Integer -> Redis (Either Reply Status)
- rpop :: ByteString -> Redis (Either Reply ByteString)
- rpoplpush :: ByteString -> ByteString -> Redis (Either Reply ByteString)
- rpush :: ByteString -> [ByteString] -> Redis (Either Reply Integer)
- rpushx :: ByteString -> ByteString -> Redis (Either Reply Integer)
- bgrewriteaof :: Redis (Either Reply Status)
- bgsave :: Redis (Either Reply Status)
- configGet :: ByteString -> Redis (Either Reply [(ByteString, ByteString)])
- configResetstat :: Redis (Either Reply Status)
- configSet :: ByteString -> ByteString -> Redis (Either Reply Status)
- dbsize :: Redis (Either Reply Integer)
- flushall :: Redis (Either Reply Status)
- flushdb :: Redis (Either Reply Status)
- info :: Redis (Either Reply ByteString)
- lastsave :: Redis (Either Reply Integer)
- save :: Redis (Either Reply Status)
- shutdown :: Redis (Either Reply Status)
- slaveof :: ByteString -> ByteString -> Redis (Either Reply Status)
- slowlogGet :: Integer -> Redis (Either Reply Reply)
- slowlogLen :: Redis (Either Reply Integer)
- slowlogReset :: Redis (Either Reply Status)
- sadd :: ByteString -> [ByteString] -> Redis (Either Reply Integer)
- scard :: ByteString -> Redis (Either Reply Integer)
- sdiff :: [ByteString] -> Redis (Either Reply [ByteString])
- sdiffstore :: ByteString -> [ByteString] -> Redis (Either Reply Integer)
- sinter :: [ByteString] -> Redis (Either Reply [ByteString])
- sinterstore :: ByteString -> [ByteString] -> Redis (Either Reply Integer)
- sismember :: ByteString -> ByteString -> Redis (Either Reply Bool)
- smembers :: ByteString -> Redis (Either Reply [ByteString])
- smove :: ByteString -> ByteString -> ByteString -> Redis (Either Reply Bool)
- spop :: ByteString -> Redis (Either Reply ByteString)
- srandmember :: ByteString -> Redis (Either Reply ByteString)
- srem :: ByteString -> [ByteString] -> Redis (Either Reply Integer)
- sunion :: [ByteString] -> Redis (Either Reply [ByteString])
- sunionstore :: ByteString -> [ByteString] -> Redis (Either Reply Integer)
- zadd :: ByteString -> [(Double, ByteString)] -> Redis (Either Reply Integer)
- zcard :: ByteString -> Redis (Either Reply Integer)
- zcount :: ByteString -> Double -> Double -> Redis (Either Reply Integer)
- zincrby :: ByteString -> Integer -> ByteString -> Redis (Either Reply Double)
- data Aggregate
- zinterstore :: ByteString -> [ByteString] -> Aggregate -> Redis (Either Reply Integer)
- zinterstoreWeights :: ByteString -> [(ByteString, Double)] -> Aggregate -> Redis (Either Reply Integer)
- zrange :: ByteString -> Integer -> Integer -> Redis (Either Reply [ByteString])
- zrangeWithscores :: ByteString -> Integer -> Integer -> Redis (Either Reply [(ByteString, Double)])
- zrangebyscore :: ByteString -> Double -> Double -> Redis (Either Reply [ByteString])
- zrangebyscoreWithscores :: ByteString -> Double -> Double -> Redis (Either Reply [(ByteString, Double)])
- zrangebyscoreLimit :: ByteString -> Double -> Double -> Integer -> Integer -> Redis (Either Reply [ByteString])
- zrangebyscoreWithscoresLimit :: ByteString -> Double -> Double -> Integer -> Integer -> Redis (Either Reply [(ByteString, Double)])
- zrank :: ByteString -> ByteString -> Redis (Either Reply Integer)
- zrem :: ByteString -> [ByteString] -> Redis (Either Reply Integer)
- zremrangebyrank :: ByteString -> Integer -> Integer -> Redis (Either Reply Integer)
- zremrangebyscore :: ByteString -> Double -> Double -> Redis (Either Reply Integer)
- zrevrange :: ByteString -> Integer -> Integer -> Redis (Either Reply [ByteString])
- zrevrangeWithscores :: ByteString -> Integer -> Integer -> Redis (Either Reply [(ByteString, Double)])
- zrevrangebyscore :: ByteString -> Double -> Double -> Redis (Either Reply [ByteString])
- zrevrangebyscoreWithscores :: ByteString -> Double -> Double -> Redis (Either Reply [(ByteString, Double)])
- zrevrangebyscoreLimit :: ByteString -> Double -> Double -> Integer -> Integer -> Redis (Either Reply [ByteString])
- zrevrangebyscoreWithscoresLimit :: ByteString -> Double -> Double -> Integer -> Integer -> Redis (Either Reply [(ByteString, Double)])
- zrevrank :: ByteString -> ByteString -> Redis (Either Reply Integer)
- zscore :: ByteString -> ByteString -> Redis (Either Reply Double)
- zunionstore :: ByteString -> [ByteString] -> Aggregate -> Redis (Either Reply Integer)
- zunionstoreWeights :: ByteString -> [(ByteString, Double)] -> Aggregate -> Redis (Either Reply Integer)
- append :: ByteString -> ByteString -> Redis (Either Reply Integer)
- decr :: ByteString -> Redis (Either Reply Integer)
- decrby :: ByteString -> Integer -> Redis (Either Reply Integer)
- get :: ByteString -> Redis (Either Reply (Maybe ByteString))
- getbit :: ByteString -> Integer -> Redis (Either Reply Integer)
- getrange :: ByteString -> Integer -> Integer -> Redis (Either Reply ByteString)
- getset :: ByteString -> ByteString -> Redis (Either Reply (Maybe ByteString))
- incr :: ByteString -> Redis (Either Reply Integer)
- incrby :: ByteString -> Integer -> Redis (Either Reply Integer)
- mget :: [ByteString] -> Redis (Either Reply [Maybe ByteString])
- mset :: [(ByteString, ByteString)] -> Redis (Either Reply Status)
- msetnx :: [(ByteString, ByteString)] -> Redis (Either Reply Bool)
- set :: ByteString -> ByteString -> Redis (Either Reply Status)
- setbit :: ByteString -> Integer -> ByteString -> Redis (Either Reply Integer)
- setex :: ByteString -> Integer -> ByteString -> Redis (Either Reply Status)
- setnx :: ByteString -> ByteString -> Redis (Either Reply Bool)
- setrange :: ByteString -> Integer -> ByteString -> Redis (Either Reply Integer)
- strlen :: ByteString -> Redis (Either Reply Integer)
- discard :: Redis (Either Reply Status)
- exec :: Redis (Either Reply Reply)
- multi :: Redis (Either Reply Status)
- unwatch :: Redis (Either Reply Status)
- watch :: [ByteString] -> Redis (Either Reply Status)
- publish :: ByteString -> ByteString -> Redis (Either Reply Integer)
- pubSub :: PubSub -> (Message -> IO PubSub) -> Redis ()
- data Message
- data PubSub
- subscribe :: [ByteString] -> PubSub
- unsubscribe :: [ByteString] -> PubSub
- psubscribe :: [ByteString] -> PubSub
- punsubscribe :: [ByteString] -> PubSub
- sendRequest :: RedisResult a => [ByteString] -> Redis (Either Reply a)
- data Reply
- = SingleLine ByteString
- | Error ByteString
- | Integer Integer
- | Bulk (Maybe ByteString)
- | MultiBulk (Maybe [Reply])
- data Status
- class RedisResult a where
The Redis Monad
Connection
connect :: HostName -> PortID -> IO RedisConnSource
Opens a connection to a Redis server at the given host and port.
disconnect :: RedisConn -> IO ()Source
Either a host name e.g., "haskell.org"
or a numeric host
address string consisting of a dotted decimal IPv4 address or an
IPv6 address e.g., "192.168.0.1"
.
The Redis default port 6379. Equivalent to
.
PortNumber
6379
Commands
Connection
Authenticate to the server (http://redis.io/commands/auth).
:: ByteString | message |
-> Redis (Either Reply ByteString) |
Echo the given string (http://redis.io/commands/echo).
Ping the server (http://redis.io/commands/ping).
Close the connection (http://redis.io/commands/quit).
Change the selected database for the current connection (http://redis.io/commands/select).
Keys
Delete a key (http://redis.io/commands/del).
Determine if a key exists (http://redis.io/commands/exists).
Set a key's time to live in seconds (http://redis.io/commands/expire).
Set the expiration for a key as a UNIX timestamp (http://redis.io/commands/expireat).
:: ByteString | pattern |
-> Redis (Either Reply [ByteString]) |
Find all keys matching the given pattern (http://redis.io/commands/keys).
Move a key to another database (http://redis.io/commands/move).
:: ByteString | key |
-> Redis (Either Reply Integer) |
Inspect the internals of Redis objects (http://redis.io/commands/object). The Redis command OBJECT
is split up into objectRefcount
, objectEncoding
, objectIdletime
.
:: ByteString | key |
-> Redis (Either Reply ByteString) |
Inspect the internals of Redis objects (http://redis.io/commands/object). The Redis command OBJECT
is split up into objectRefcount
, objectEncoding
, objectIdletime
.
:: ByteString | key |
-> Redis (Either Reply Integer) |
Inspect the internals of Redis objects (http://redis.io/commands/object). The Redis command OBJECT
is split up into objectRefcount
, objectEncoding
, objectIdletime
.
Remove the expiration from a key (http://redis.io/commands/persist).
Return a random key from the keyspace (http://redis.io/commands/randomkey).
:: ByteString | key |
-> ByteString | newkey |
-> Redis (Either Reply Status) |
Rename a key (http://redis.io/commands/rename).
:: ByteString | key |
-> ByteString | newkey |
-> Redis (Either Reply Bool) |
Rename a key, only if the new key does not exist (http://redis.io/commands/renamenx).
:: ByteString | key |
-> SortOpts | |
-> Redis (Either Reply [ByteString]) |
Sort the elements in a list, set or sorted set (http://redis.io/commands/sort). The Redis command SORT
is split up into sort
, sortStore
.
:: ByteString | key |
-> ByteString | destination |
-> SortOpts | |
-> Redis (Either Reply Integer) |
Sort the elements in a list, set or sorted set (http://redis.io/commands/sort). The Redis command SORT
is split up into sort
, sortStore
.
Get the time to live for a key (http://redis.io/commands/ttl).
Determine the type stored at key (http://redis.io/commands/type).
Hashes
:: ByteString | key |
-> [ByteString] | field |
-> Redis (Either Reply Bool) |
Delete one or more hash fields (http://redis.io/commands/hdel).
:: ByteString | key |
-> ByteString | field |
-> Redis (Either Reply Bool) |
Determine if a hash field exists (http://redis.io/commands/hexists).
:: ByteString | key |
-> ByteString | field |
-> Redis (Either Reply (Maybe ByteString)) |
Get the value of a hash field (http://redis.io/commands/hget).
:: ByteString | key |
-> Redis (Either Reply [(ByteString, ByteString)]) |
Get all the fields and values in a hash (http://redis.io/commands/hgetall).
:: ByteString | key |
-> ByteString | field |
-> Integer | increment |
-> Redis (Either Reply Integer) |
Increment the integer value of a hash field by the given number (http://redis.io/commands/hincrby).
:: ByteString | key |
-> Redis (Either Reply [ByteString]) |
Get all the fields in a hash (http://redis.io/commands/hkeys).
Get the number of fields in a hash (http://redis.io/commands/hlen).
:: ByteString | key |
-> [ByteString] | field |
-> Redis (Either Reply [Maybe ByteString]) |
Get the values of all the given hash fields (http://redis.io/commands/hmget).
:: ByteString | key |
-> [(ByteString, ByteString)] | fieldValue |
-> Redis (Either Reply Status) |
Set multiple hash fields to multiple values (http://redis.io/commands/hmset).
:: ByteString | key |
-> ByteString | field |
-> ByteString | value |
-> Redis (Either Reply Bool) |
Set the string value of a hash field (http://redis.io/commands/hset).
:: ByteString | key |
-> ByteString | field |
-> ByteString | value |
-> Redis (Either Reply Bool) |
Set the value of a hash field, only if the field does not exist (http://redis.io/commands/hsetnx).
:: ByteString | key |
-> Redis (Either Reply [ByteString]) |
Get all the values in a hash (http://redis.io/commands/hvals).
Lists
:: [ByteString] | key |
-> Integer | timeout |
-> Redis (Either Reply (ByteString, ByteString)) |
Remove and get the first element in a list, or block until one is available (http://redis.io/commands/blpop).
:: [ByteString] | key |
-> Integer | timeout |
-> Redis (Either Reply (ByteString, ByteString)) |
Remove and get the last element in a list, or block until one is available (http://redis.io/commands/brpop).
:: ByteString | source |
-> ByteString | destination |
-> Integer | timeout |
-> Redis (Either Reply ByteString) |
Pop a value from a list, push it to another list and return it; or block until one is available (http://redis.io/commands/brpoplpush).
:: ByteString | key |
-> Integer | index |
-> Redis (Either Reply ByteString) |
Get an element from a list by its index (http://redis.io/commands/lindex).
:: ByteString | key |
-> ByteString | pivot |
-> ByteString | value |
-> Redis (Either Reply Integer) |
Insert an element before or after another element in a list (http://redis.io/commands/linsert). The Redis command LINSERT
is split up into linsertBefore
, linsertAfter
.
:: ByteString | key |
-> ByteString | pivot |
-> ByteString | value |
-> Redis (Either Reply Integer) |
Insert an element before or after another element in a list (http://redis.io/commands/linsert). The Redis command LINSERT
is split up into linsertBefore
, linsertAfter
.
Get the length of a list (http://redis.io/commands/llen).
:: ByteString | key |
-> Redis (Either Reply ByteString) |
Remove and get the first element in a list (http://redis.io/commands/lpop).
:: ByteString | key |
-> [ByteString] | value |
-> Redis (Either Reply Integer) |
Prepend one or multiple values to a list (http://redis.io/commands/lpush).
:: ByteString | key |
-> ByteString | value |
-> Redis (Either Reply Integer) |
Prepend a value to a list, only if the list exists (http://redis.io/commands/lpushx).
:: ByteString | key |
-> Integer | start |
-> Integer | stop |
-> Redis (Either Reply [ByteString]) |
Get a range of elements from a list (http://redis.io/commands/lrange).
:: ByteString | key |
-> Integer | count |
-> ByteString | value |
-> Redis (Either Reply Integer) |
Remove elements from a list (http://redis.io/commands/lrem).
:: ByteString | key |
-> Integer | index |
-> ByteString | value |
-> Redis (Either Reply Status) |
Set the value of an element in a list by its index (http://redis.io/commands/lset).
Trim a list to the specified range (http://redis.io/commands/ltrim).
:: ByteString | key |
-> Redis (Either Reply ByteString) |
Remove and get the last element in a list (http://redis.io/commands/rpop).
:: ByteString | source |
-> ByteString | destination |
-> Redis (Either Reply ByteString) |
Remove the last element in a list, append it to another list and return it (http://redis.io/commands/rpoplpush).
:: ByteString | key |
-> [ByteString] | value |
-> Redis (Either Reply Integer) |
Append one or multiple values to a list (http://redis.io/commands/rpush).
:: ByteString | key |
-> ByteString | value |
-> Redis (Either Reply Integer) |
Append a value to a list, only if the list exists (http://redis.io/commands/rpushx).
Server
Asynchronously rewrite the append-only file (http://redis.io/commands/bgrewriteaof).
Asynchronously save the dataset to disk (http://redis.io/commands/bgsave).
:: ByteString | parameter |
-> Redis (Either Reply [(ByteString, ByteString)]) |
Get the value of a configuration parameter (http://redis.io/commands/config-get).
Reset the stats returned by INFO (http://redis.io/commands/config-resetstat).
:: ByteString | parameter |
-> ByteString | value |
-> Redis (Either Reply Status) |
Set a configuration parameter to the given value (http://redis.io/commands/config-set).
Return the number of keys in the selected database (http://redis.io/commands/dbsize).
Remove all keys from all databases (http://redis.io/commands/flushall).
Remove all keys from the current database (http://redis.io/commands/flushdb).
Get information and statistics about the server (http://redis.io/commands/info).
Get the UNIX time stamp of the last successful save to disk (http://redis.io/commands/lastsave).
Synchronously save the dataset to disk (http://redis.io/commands/save).
Synchronously save the dataset to disk and then shut down the server (http://redis.io/commands/shutdown).
:: ByteString | host |
-> ByteString | port |
-> Redis (Either Reply Status) |
Make the server a slave of another instance, or promote it as master (http://redis.io/commands/slaveof).
Manages the Redis slow queries log (http://redis.io/commands/slowlog). The Redis command SLOWLOG
is split up into slowlogGet
, slowlogLen
, slowlogReset
.
Manages the Redis slow queries log (http://redis.io/commands/slowlog). The Redis command SLOWLOG
is split up into slowlogGet
, slowlogLen
, slowlogReset
.
Manages the Redis slow queries log (http://redis.io/commands/slowlog). The Redis command SLOWLOG
is split up into slowlogGet
, slowlogLen
, slowlogReset
.
Sets
:: ByteString | key |
-> [ByteString] | member |
-> Redis (Either Reply Integer) |
Add one or more members to a set (http://redis.io/commands/sadd).
Get the number of members in a set (http://redis.io/commands/scard).
:: [ByteString] | key |
-> Redis (Either Reply [ByteString]) |
Subtract multiple sets (http://redis.io/commands/sdiff).
:: ByteString | destination |
-> [ByteString] | key |
-> Redis (Either Reply Integer) |
Subtract multiple sets and store the resulting set in a key (http://redis.io/commands/sdiffstore).
:: [ByteString] | key |
-> Redis (Either Reply [ByteString]) |
Intersect multiple sets (http://redis.io/commands/sinter).
:: ByteString | destination |
-> [ByteString] | key |
-> Redis (Either Reply Integer) |
Intersect multiple sets and store the resulting set in a key (http://redis.io/commands/sinterstore).
:: ByteString | key |
-> ByteString | member |
-> Redis (Either Reply Bool) |
Determine if a given value is a member of a set (http://redis.io/commands/sismember).
:: ByteString | key |
-> Redis (Either Reply [ByteString]) |
Get all the members in a set (http://redis.io/commands/smembers).
:: ByteString | source |
-> ByteString | destination |
-> ByteString | member |
-> Redis (Either Reply Bool) |
Move a member from one set to another (http://redis.io/commands/smove).
:: ByteString | key |
-> Redis (Either Reply ByteString) |
Remove and return a random member from a set (http://redis.io/commands/spop).
:: ByteString | key |
-> Redis (Either Reply ByteString) |
Get a random member from a set (http://redis.io/commands/srandmember).
:: ByteString | key |
-> [ByteString] | member |
-> Redis (Either Reply Integer) |
Remove one or more members from a set (http://redis.io/commands/srem).
:: [ByteString] | key |
-> Redis (Either Reply [ByteString]) |
Add multiple sets (http://redis.io/commands/sunion).
:: ByteString | destination |
-> [ByteString] | key |
-> Redis (Either Reply Integer) |
Add multiple sets and store the resulting set in a key (http://redis.io/commands/sunionstore).
Sorted Sets
:: ByteString | key |
-> [(Double, ByteString)] | scoreMember |
-> Redis (Either Reply Integer) |
Add one or more members to a sorted set, or update its score if it already exists (http://redis.io/commands/zadd).
Get the number of members in a sorted set (http://redis.io/commands/zcard).
Count the members in a sorted set with scores within the given values (http://redis.io/commands/zcount).
:: ByteString | key |
-> Integer | increment |
-> ByteString | member |
-> Redis (Either Reply Double) |
Increment the score of a member in a sorted set (http://redis.io/commands/zincrby).
:: ByteString | destination |
-> [ByteString] | keys |
-> Aggregate | |
-> Redis (Either Reply Integer) |
Intersect multiple sorted sets and store the resulting sorted set in a new key (http://redis.io/commands/zinterstore). The Redis command ZINTERSTORE
is split up into zinterstore
, zinterstoreWeights
.
:: ByteString | destination |
-> [(ByteString, Double)] | weighted keys |
-> Aggregate | |
-> Redis (Either Reply Integer) |
Intersect multiple sorted sets and store the resulting sorted set in a new key (http://redis.io/commands/zinterstore). The Redis command ZINTERSTORE
is split up into zinterstore
, zinterstoreWeights
.
:: ByteString | key |
-> Integer | start |
-> Integer | stop |
-> Redis (Either Reply [ByteString]) |
Return a range of members in a sorted set, by index (http://redis.io/commands/zrange). The Redis command ZRANGE
is split up into zrange
, zrangeWithscores
.
:: ByteString | key |
-> Integer | start |
-> Integer | stop |
-> Redis (Either Reply [(ByteString, Double)]) |
Return a range of members in a sorted set, by index (http://redis.io/commands/zrange). The Redis command ZRANGE
is split up into zrange
, zrangeWithscores
.
:: ByteString | key |
-> Double | min |
-> Double | max |
-> Redis (Either Reply [ByteString]) |
Return a range of members in a sorted set, by score (http://redis.io/commands/zrangebyscore). The Redis command ZRANGEBYSCORE
is split up into zrangebyscore
, zrangebyscoreWithscores
, zrangebyscoreLimit
, zrangebyscoreWithscoresLimit
.
:: ByteString | key |
-> Double | min |
-> Double | max |
-> Redis (Either Reply [(ByteString, Double)]) |
Return a range of members in a sorted set, by score (http://redis.io/commands/zrangebyscore). The Redis command ZRANGEBYSCORE
is split up into zrangebyscore
, zrangebyscoreWithscores
, zrangebyscoreLimit
, zrangebyscoreWithscoresLimit
.
:: ByteString | key |
-> Double | min |
-> Double | max |
-> Integer | offset |
-> Integer | count |
-> Redis (Either Reply [ByteString]) |
Return a range of members in a sorted set, by score (http://redis.io/commands/zrangebyscore). The Redis command ZRANGEBYSCORE
is split up into zrangebyscore
, zrangebyscoreWithscores
, zrangebyscoreLimit
, zrangebyscoreWithscoresLimit
.
zrangebyscoreWithscoresLimitSource
:: ByteString | key |
-> Double | min |
-> Double | max |
-> Integer | offset |
-> Integer | count |
-> Redis (Either Reply [(ByteString, Double)]) |
Return a range of members in a sorted set, by score (http://redis.io/commands/zrangebyscore). The Redis command ZRANGEBYSCORE
is split up into zrangebyscore
, zrangebyscoreWithscores
, zrangebyscoreLimit
, zrangebyscoreWithscoresLimit
.
:: ByteString | key |
-> ByteString | member |
-> Redis (Either Reply Integer) |
Determine the index of a member in a sorted set (http://redis.io/commands/zrank).
:: ByteString | key |
-> [ByteString] | member |
-> Redis (Either Reply Integer) |
Remove one or more members from a sorted set (http://redis.io/commands/zrem).
Remove all members in a sorted set within the given indexes (http://redis.io/commands/zremrangebyrank).
Remove all members in a sorted set within the given scores (http://redis.io/commands/zremrangebyscore).
:: ByteString | key |
-> Integer | start |
-> Integer | stop |
-> Redis (Either Reply [ByteString]) |
Return a range of members in a sorted set, by index, with scores ordered from high to low (http://redis.io/commands/zrevrange). The Redis command ZREVRANGE
is split up into zrevrange
, zrevrangeWithscores
.
:: ByteString | key |
-> Integer | start |
-> Integer | stop |
-> Redis (Either Reply [(ByteString, Double)]) |
Return a range of members in a sorted set, by index, with scores ordered from high to low (http://redis.io/commands/zrevrange). The Redis command ZREVRANGE
is split up into zrevrange
, zrevrangeWithscores
.
:: ByteString | key |
-> Double | max |
-> Double | min |
-> Redis (Either Reply [ByteString]) |
Return a range of members in a sorted set, by score, with scores ordered from high to low (http://redis.io/commands/zrevrangebyscore). The Redis command ZREVRANGEBYSCORE
is split up into zrevrangebyscore
, zrevrangebyscoreWithscores
, zrevrangebyscoreLimit
, zrevrangebyscoreWithscoresLimit
.
zrevrangebyscoreWithscoresSource
:: ByteString | key |
-> Double | max |
-> Double | min |
-> Redis (Either Reply [(ByteString, Double)]) |
Return a range of members in a sorted set, by score, with scores ordered from high to low (http://redis.io/commands/zrevrangebyscore). The Redis command ZREVRANGEBYSCORE
is split up into zrevrangebyscore
, zrevrangebyscoreWithscores
, zrevrangebyscoreLimit
, zrevrangebyscoreWithscoresLimit
.
:: ByteString | key |
-> Double | max |
-> Double | min |
-> Integer | offset |
-> Integer | count |
-> Redis (Either Reply [ByteString]) |
Return a range of members in a sorted set, by score, with scores ordered from high to low (http://redis.io/commands/zrevrangebyscore). The Redis command ZREVRANGEBYSCORE
is split up into zrevrangebyscore
, zrevrangebyscoreWithscores
, zrevrangebyscoreLimit
, zrevrangebyscoreWithscoresLimit
.
zrevrangebyscoreWithscoresLimitSource
:: ByteString | key |
-> Double | max |
-> Double | min |
-> Integer | offset |
-> Integer | count |
-> Redis (Either Reply [(ByteString, Double)]) |
Return a range of members in a sorted set, by score, with scores ordered from high to low (http://redis.io/commands/zrevrangebyscore). The Redis command ZREVRANGEBYSCORE
is split up into zrevrangebyscore
, zrevrangebyscoreWithscores
, zrevrangebyscoreLimit
, zrevrangebyscoreWithscoresLimit
.
:: ByteString | key |
-> ByteString | member |
-> Redis (Either Reply Integer) |
Determine the index of a member in a sorted set, with scores ordered from high to low (http://redis.io/commands/zrevrank).
:: ByteString | key |
-> ByteString | member |
-> Redis (Either Reply Double) |
Get the score associated with the given member in a sorted set (http://redis.io/commands/zscore).
:: ByteString | destination |
-> [ByteString] | keys |
-> Aggregate | |
-> Redis (Either Reply Integer) |
Add multiple sorted sets and store the resulting sorted set in a new key (http://redis.io/commands/zunionstore). The Redis command ZUNIONSTORE
is split up into zunionstore
, zunionstoreWeights
.
:: ByteString | destination |
-> [(ByteString, Double)] | weighted keys |
-> Aggregate | |
-> Redis (Either Reply Integer) |
Add multiple sorted sets and store the resulting sorted set in a new key (http://redis.io/commands/zunionstore). The Redis command ZUNIONSTORE
is split up into zunionstore
, zunionstoreWeights
.
Strings
:: ByteString | key |
-> ByteString | value |
-> Redis (Either Reply Integer) |
Append a value to a key (http://redis.io/commands/append).
Decrement the integer value of a key by one (http://redis.io/commands/decr).
Decrement the integer value of a key by the given number (http://redis.io/commands/decrby).
:: ByteString | key |
-> Redis (Either Reply (Maybe ByteString)) |
Get the value of a key (http://redis.io/commands/get).
Returns the bit value at offset in the string value stored at key (http://redis.io/commands/getbit).
:: ByteString | key |
-> Integer | start |
-> Integer | end |
-> Redis (Either Reply ByteString) |
Get a substring of the string stored at a key (http://redis.io/commands/getrange).
:: ByteString | key |
-> ByteString | value |
-> Redis (Either Reply (Maybe ByteString)) |
Set the string value of a key and return its old value (http://redis.io/commands/getset).
Increment the integer value of a key by one (http://redis.io/commands/incr).
Increment the integer value of a key by the given number (http://redis.io/commands/incrby).
:: [ByteString] | key |
-> Redis (Either Reply [Maybe ByteString]) |
Get the values of all the given keys (http://redis.io/commands/mget).
:: [(ByteString, ByteString)] | keyValue |
-> Redis (Either Reply Status) |
Set multiple keys to multiple values (http://redis.io/commands/mset).
:: [(ByteString, ByteString)] | keyValue |
-> Redis (Either Reply Bool) |
Set multiple keys to multiple values, only if none of the keys exist (http://redis.io/commands/msetnx).
:: ByteString | key |
-> ByteString | value |
-> Redis (Either Reply Status) |
Set the string value of a key (http://redis.io/commands/set).
:: ByteString | key |
-> Integer | offset |
-> ByteString | value |
-> Redis (Either Reply Integer) |
Sets or clears the bit at offset in the string value stored at key (http://redis.io/commands/setbit).
:: ByteString | key |
-> Integer | seconds |
-> ByteString | value |
-> Redis (Either Reply Status) |
Set the value and expiration of a key (http://redis.io/commands/setex).
:: ByteString | key |
-> ByteString | value |
-> Redis (Either Reply Bool) |
Set the value of a key, only if the key does not exist (http://redis.io/commands/setnx).
:: ByteString | key |
-> Integer | offset |
-> ByteString | value |
-> Redis (Either Reply Integer) |
Overwrite part of a string at key starting at the specified offset (http://redis.io/commands/setrange).
Get the length of the value stored in a key (http://redis.io/commands/strlen).
Transactions
Discard all commands issued after MULTI (http://redis.io/commands/discard).
Execute all commands issued after MULTI (http://redis.io/commands/exec).
Mark the start of a transaction block (http://redis.io/commands/multi).
Forget about all watched keys (http://redis.io/commands/unwatch).
Watch the given keys to determine execution of the MULTIEXEC block (<http:redis.iocommands/watch>).
Unimplemented Commands
These commands are not implemented, as of now. Library users can implement them with the sendRequest
function.
- EVAL (http://redis.io/commands/eval)
- MONITOR (http://redis.io/commands/monitor)
- DEBUG OBJECT (http://redis.io/commands/debug-object)
- DEBUG SEGFAULT (http://redis.io/commands/debug-segfault)
- SYNC (http://redis.io/commands/sync)
Pub/Sub
:: ByteString | channel |
-> ByteString | message |
-> Redis (Either Reply Integer) |
Post a message to a channel (http://redis.io/commands/publish).
Listens to published messages on subscribed channels.
The given callback function is called for each received message.
Subscription changes are triggered by the returned PubSub
. To keep
subscriptions unchanged, the callback can return mempty
.
Example: Subscribe to the "news" channel indefinitely.
pubSub (subscribe ["news"]) $ \msg -> do putStrLn $ "Message from " ++ show (msgChannel msg) return mempty
Example: Receive a single message from the "chat" channel.
pubSub (subscribe ["chat"]) $ \msg -> do putStrLn $ "Message from " ++ show (msgChannel msg) return $ unsubscribe ["chat"]
:: [ByteString] | channel |
-> PubSub |
Listen for messages published to the given channels (http://redis.io/commands/subscribe).
:: [ByteString] | channel |
-> PubSub |
Stop listening for messages posted to the given channels (http://redis.io/commands/unsubscribe).
:: [ByteString] | pattern |
-> PubSub |
Listen for messages published to channels matching the given patterns (http://redis.io/commands/psubscribe).
:: [ByteString] | pattern |
-> PubSub |
Stop listening for messages posted to channels matching the given patterns (http://redis.io/commands/punsubscribe).
Low-Level Requests and Replies
sendRequest :: RedisResult a => [ByteString] -> Redis (Either Reply a)Source
Sends a request to the Redis server, returning the decode
d reply.
sendRequest
can be used to implement one of the unimplemented
commands, as shown below.
-- |Redis DEBUG OBJECT command debugObject :: ByteString ->Redis
(EitherReply
ByteString) debugObject key =sendRequest
["DEBUG", "OBJECT",encode
key]
Low-level representation of replies from the Redis server.
class RedisResult a whereSource
RedisResult Bool | |
RedisResult Double | |
RedisResult Integer | |
RedisResult ByteString | |
RedisResult Reply | |
RedisResult Status | |
(RedisResult k, RedisResult v) => RedisResult [(k, v)] | |
RedisResult a => RedisResult [a] | |
RedisResult a => RedisResult (Maybe a) | |
(RedisResult a, RedisResult b) => RedisResult (a, b) |