Database.Redis.Redis

redis-0.13: A driver for Redis key-value database

Safe Haskell | None

Database.Redis.Redis

Contents

- Types ans Constructors
- Database connection
- Redis commands
  - Generic
  - Strings
  - Lists
  - Sets
  - Sorted sets
  - Hashes
  - Sorting
  - Publish/Subscribe
  - Persistent control

Description

Main Redis API and protocol implementation

Synopsis

- data Redis
- data Reply s
  - = RTimeout
  - | RParseError String
  - | ROk
  - | RPong
  - | RQueued
  - | RError String
  - | RInline s
  - | RInt Int
  - | RBulk (Maybe s)
  - | RMulti (Maybe [Reply s])
- data Message s
  - = MSubscribe s Int
  - | MUnsubscribe s Int
  - | MPSubscribe s Int
  - | MPUnsubscribe s Int
  - | MMessage s s
  - | MPMessage s s s
- data LInsertDirection
  - = BEFORE
  - | AFTER
- data Interval a
  - = Closed a a
  - | Open a a
  - | LeftOpen a a
  - | RightOpen a a
- class IsInterval i a | i -> a where
  - toInterval :: i -> Interval a
- data SortOptions s = SortOptions {
  - desc :: Bool
  - limit :: (Int, Int)
  - alpha :: Bool
  - sort_by :: s
  - get_obj :: [s]
  - store :: s
  }
- data Aggregate
  - = SUM
  - | MIN
  - | MAX
- data RedisKeyType
  - = RTNone
  - | RTString
  - | RTList
  - | RTSet
  - | RTZSet
  - | RTHash
- type RedisInfo = Map String String
- sortDefaults :: SortOptions ByteString
- fromRInline :: (Monad m, BS s) => Reply s -> m s
- fromRBulk :: (Monad m, BS s) => Reply s -> m (Maybe s)
- fromRBulk' :: (Monad m, BS s) => Reply s -> m s
- fromRMulti :: (Monad m, BS s) => Reply s -> m (Maybe [Reply s])
- fromRMultiBulk :: (Monad m, BS s) => Reply s -> m (Maybe [Maybe s])
- fromRMultiBulk' :: (Monad m, BS s) => Reply s -> m [s]
- fromRInt :: (Monad m, BS s) => Reply s -> m Int
- fromROk :: (Monad m, BS s) => Reply s -> m ()
- noError :: (Monad m, BS s) => Reply s -> m ()
- parseMessage :: (Monad m, BS s) => Reply ByteString -> m (Message s)
- takeAll :: (Int, Int)
- localhost :: String
- defaultPort :: String
- connect :: String -> String -> IO Redis
- disconnect :: Redis -> IO ()
- isConnected :: Redis -> IO Bool
- getServer :: Redis -> IO (String, String)
- getDatabase :: Redis -> IO Int
- renameCommand :: Redis -> ByteString -> ByteString -> IO ()
- ping :: Redis -> IO (Reply ())
- auth :: BS s => Redis -> s -> IO (Reply ())
- echo :: BS s => Redis -> s -> IO (Reply s)
- quit :: Redis -> IO ()
- shutdown :: Redis -> IO ()
- multi :: Redis -> IO (Reply ())
- exec :: BS s => Redis -> IO (Reply s)
- discard :: Redis -> IO (Reply ())
- run_multi :: BS s => Redis -> (Redis -> IO ()) -> IO (Reply s)
- watch :: BS s => Redis -> [s] -> IO (Reply ())
- unwatch :: Redis -> IO (Reply ())
- run_cas :: BS s1 => Redis -> [s1] -> (Redis -> IO a) -> IO a
- exists :: BS s => Redis -> s -> IO (Reply Int)
- del :: BS s => Redis -> s -> IO (Reply Int)
- del_ :: BS s => Redis -> [s] -> IO (Reply Int)
- getType :: BS s => Redis -> s -> IO RedisKeyType
- keys :: (BS s1, BS s2) => Redis -> s1 -> IO (Reply s2)
- randomKey :: BS s => Redis -> IO (Reply s)
- rename :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply ())
- renameNx :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply Int)
- dbsize :: Redis -> IO (Reply Int)
- expire :: BS s => Redis -> s -> Int -> IO (Reply Int)
- expireAt :: BS s => Redis -> s -> Int -> IO (Reply Int)
- persist :: BS s => Redis -> s -> IO (Reply Int)
- ttl :: BS s => Redis -> s -> IO (Reply Int)
- select :: Redis -> Int -> IO (Reply ())
- move :: BS s => Redis -> s -> Int -> IO (Reply Int)
- flushDb :: Redis -> IO (Reply ())
- flushAll :: Redis -> IO (Reply ())
- info :: Redis -> IO RedisInfo
- set :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply ())
- setNx :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply Int)
- setEx :: (BS s1, BS s2) => Redis -> s1 -> Int -> s2 -> IO (Reply ())
- mSet :: (BS s1, BS s2) => Redis -> [(s1, s2)] -> IO (Reply ())
- mSetNx :: (BS s1, BS s2) => Redis -> [(s1, s2)] -> IO (Reply Int)
- get :: (BS s1, BS s2) => Redis -> s1 -> IO (Reply s2)
- getSet :: (BS s1, BS s2, BS s3) => Redis -> s1 -> s2 -> IO (Reply s3)
- mGet :: (BS s1, BS s2) => Redis -> [s1] -> IO (Reply s2)
- incr :: BS s => Redis -> s -> IO (Reply Int)
- incrBy :: BS s => Redis -> s -> Int -> IO (Reply Int)
- incrByFloat :: BS s => Redis -> s -> Double -> IO (Reply Double)
- decr :: BS s => Redis -> s -> IO (Reply Int)
- decrBy :: BS s => Redis -> s -> Int -> IO (Reply Int)
- append :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply Int)
- substr :: (BS s1, BS s2) => Redis -> s1 -> (Int, Int) -> IO (Reply s2)
- getrange :: (BS s1, BS s2) => Redis -> s1 -> (Int, Int) -> IO (Reply s2)
- setrange :: (BS s1, BS s2) => Redis -> s1 -> Int -> s2 -> IO (Reply Int)
- getbit :: BS s => Redis -> s -> Int -> IO (Reply Int)
- setbit :: BS s => Redis -> s -> Int -> Int -> IO (Reply Int)
- strlen :: BS s => Redis -> s -> IO (Reply Int)
- rpush :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply Int)
- rpush_ :: (BS s1, BS s2) => Redis -> s1 -> [s2] -> IO (Reply Int)
- lpush :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply Int)
- lpush_ :: (BS s1, BS s2) => Redis -> s1 -> [s2] -> IO (Reply Int)
- rpushx :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply Int)
- lpushx :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply Int)
- linsert :: (BS s1, BS s2, BS s3) => Redis -> s1 -> LInsertDirection -> s2 -> s3 -> IO (Reply Int)
- llen :: BS s => Redis -> s -> IO (Reply Int)
- lrange :: (BS s1, BS s2) => Redis -> s1 -> (Int, Int) -> IO (Reply s2)
- ltrim :: BS s => Redis -> s -> (Int, Int) -> IO (Reply ())
- lindex :: (BS s1, BS s2) => Redis -> s1 -> Int -> IO (Reply s2)
- lset :: (BS s1, BS s2) => Redis -> s1 -> Int -> s2 -> IO (Reply ())
- lrem :: (BS s1, BS s2) => Redis -> s1 -> Int -> s2 -> IO (Reply Int)
- lpop :: (BS s1, BS s2) => Redis -> s1 -> IO (Reply s2)
- rpop :: (BS s1, BS s2) => Redis -> s1 -> IO (Reply s2)
- rpoplpush :: (BS s1, BS s2, BS s3) => Redis -> s1 -> s2 -> IO (Reply s3)
- blpop :: (BS s1, BS s2) => Redis -> [s1] -> Int -> IO (Maybe (s1, s2))
- brpop :: (BS s1, BS s2) => Redis -> [s1] -> Int -> IO (Maybe (s1, s2))
- brpoplpush :: (BS s1, BS s2, BS s3) => Redis -> s1 -> s2 -> Int -> IO (Maybe (Maybe s3))
- sadd :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply Int)
- sadd_ :: (BS s1, BS s2) => Redis -> s1 -> [s2] -> IO (Reply Int)
- srem :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply Int)
- srem_ :: (BS s1, BS s2) => Redis -> s1 -> [s2] -> IO (Reply Int)
- spop :: (BS s1, BS s2) => Redis -> s1 -> IO (Reply s2)
- smove :: (BS s1, BS s2, BS s3) => Redis -> s1 -> s2 -> s3 -> IO (Reply Int)
- scard :: BS s => Redis -> s -> IO (Reply Int)
- sismember :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply Int)
- smembers :: (BS s1, BS s2) => Redis -> s1 -> IO (Reply s2)
- srandmember :: (BS s1, BS s2) => Redis -> s1 -> IO (Reply s2)
- sinter :: (BS s1, BS s2) => Redis -> [s1] -> IO (Reply s2)
- sinterStore :: (BS s1, BS s2) => Redis -> s1 -> [s2] -> IO (Reply ())
- sunion :: (BS s1, BS s2) => Redis -> [s1] -> IO (Reply s2)
- sunionStore :: (BS s1, BS s2) => Redis -> s1 -> [s2] -> IO (Reply ())
- sdiff :: (BS s1, BS s2) => Redis -> [s1] -> IO (Reply s2)
- sdiffStore :: (BS s1, BS s2) => Redis -> s1 -> [s2] -> IO (Reply ())
- zadd :: (BS s1, BS s2) => Redis -> s1 -> Double -> s2 -> IO (Reply Int)
- zadd_ :: (BS s1, BS s2) => Redis -> s1 -> [(Double, s2)] -> IO (Reply Int)
- zrem :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply Int)
- zrem_ :: (BS s1, BS s2) => Redis -> s1 -> [s2] -> IO (Reply Int)
- zincrBy :: (BS s1, BS s2, BS s3) => Redis -> s1 -> Double -> s2 -> IO (Reply s3)
- zrange :: (BS s1, BS s2) => Redis -> s1 -> (Int, Int) -> Bool -> IO (Reply s2)
- zrevrange :: (BS s1, BS s2) => Redis -> s1 -> (Int, Int) -> Bool -> IO (Reply s2)
- zrangebyscore :: (IsInterval i Double, BS s1, BS s2) => Redis -> s1 -> i -> Maybe (Int, Int) -> Bool -> IO (Reply s2)
- zrevrangebyscore :: (IsInterval i Double, BS s1, BS s2) => Redis -> s1 -> i -> Maybe (Int, Int) -> Bool -> IO (Reply s2)
- zcount :: (IsInterval i Double, BS s) => Redis -> s -> i -> IO (Reply Int)
- zremrangebyscore :: BS s => Redis -> s -> (Double, Double) -> IO (Reply Int)
- zcard :: BS s => Redis -> s -> IO (Reply Int)
- zscore :: (BS s1, BS s2, BS s3) => Redis -> s1 -> s2 -> IO (Reply s3)
- zrank :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply Int)
- zrevrank :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply Int)
- zremrangebyrank :: BS s => Redis -> s -> (Int, Int) -> IO (Reply Int)
- zunion :: (BS s1, BS s2) => Redis -> s1 -> [s2] -> [Double] -> Aggregate -> IO (Reply Int)
- zinter :: (BS s1, BS s2) => Redis -> s1 -> [s2] -> [Double] -> Aggregate -> IO (Reply Int)
- zunionStore :: (BS s1, BS s2) => Redis -> s1 -> [s2] -> [Double] -> Aggregate -> IO (Reply Int)
- zinterStore :: (BS s1, BS s2) => Redis -> s1 -> [s2] -> [Double] -> Aggregate -> IO (Reply Int)
- hset :: (BS s1, BS s2, BS s3) => Redis -> s1 -> s2 -> s3 -> IO (Reply Int)
- hget :: (BS s1, BS s2, BS s3) => Redis -> s1 -> s2 -> IO (Reply s3)
- hdel :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply Int)
- hdel_ :: (BS s1, BS s2) => Redis -> s1 -> [s2] -> IO (Reply Int)
- hmset :: (BS s1, BS s2, BS s3) => Redis -> s1 -> [(s2, s3)] -> IO (Reply ())
- hmget :: (BS s1, BS s2, BS s3) => Redis -> s1 -> [s2] -> IO (Reply s3)
- hincrBy :: (BS s1, BS s2) => Redis -> s1 -> s2 -> Int -> IO (Reply Int)
- hincrByFloat :: (BS s1, BS s2) => Redis -> s1 -> s2 -> Double -> IO (Reply Double)
- hexists :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply Int)
- hlen :: BS s => Redis -> s -> IO (Reply Int)
- hkeys :: (BS s1, BS s2) => Redis -> s1 -> IO (Reply s2)
- hvals :: (BS s1, BS s2) => Redis -> s1 -> IO (Reply s2)
- hgetall :: (BS s1, BS s2) => Redis -> s1 -> IO (Reply s2)
- sort :: (BS s1, BS s2, BS s3) => Redis -> s1 -> SortOptions s2 -> IO (Reply s3)
- listRelated :: (BS s1, BS s2, BS s3) => Redis -> s1 -> s2 -> (Int, Int) -> IO (Reply s3)
- subscribed :: Redis -> IO Int
- subscribe :: (BS s1, BS s2) => Redis -> [s1] -> IO [Message s2]
- unsubscribe :: (BS s1, BS s2) => Redis -> [s1] -> IO [Message s2]
- psubscribe :: (BS s1, BS s2) => Redis -> [s1] -> IO [Message s2]
- punsubscribe :: (BS s1, BS s2) => Redis -> [s1] -> IO [Message s2]
- publish :: (BS s1, BS s2) => Redis -> s1 -> s2 -> IO (Reply Int)
- listen :: BS s => Redis -> Int -> IO (Maybe (Message s))
- save :: Redis -> IO (Reply ())
- bgsave :: Redis -> IO (Reply ())
- lastsave :: Redis -> IO (Reply Int)
- bgrewriteaof :: Redis -> IO (Reply ())

# Types ans Constructors

data Redis

Redis connection descriptor

Instances

Eq Redis |
WithRedis RedisM |

data Reply s

Redis reply variants

Constructors

RTimeout | Timeout. Currently unused
RParseError String | Error converting value from ByteString. It's a client-side error.
ROk | "Ok" reply
RPong | Reply for the ping command
RQueued | Used inside multi-exec block
RError String | Some kind of server-side error
RInline s | Simple oneline reply
RInt Int | Integer reply
RBulk (Maybe s) | Multiline reply
RMulti (Maybe [Reply s]) | Complex reply. It may consists of various type of replys

Instances

Eq s => Eq (Reply s) |
BS s => Show (Reply s) |

data Message s

Constructors

MSubscribe s Int | subscribed
MUnsubscribe s Int | unsubscribed
MPSubscribe s Int | pattern subscribed
MPUnsubscribe s Int | pattern unsubscribed
MMessage s s | message recieved
MPMessage s s s | message recieved by pattern

Instances

Eq s => Eq (Message s) |
Show s => Show (Message s) |

data LInsertDirection

Constructors

BEFORE |
AFTER |

Instances

Show LInsertDirection |

data Interval a

Interval representation

Constructors

Closed a a | closed interval [a, b]
Open a a | open interval (a, b)
LeftOpen a a | left-open interval (a, b]
RightOpen a a | right-open interval [a, b)

Instances

Show a => Show (Interval a) |
IsInterval (Interval a) a | Trivial IsInterval instance

class IsInterval i a | i -> a where

Class for conversion value to `Interval`

Definied instances is:

- the Interval itself
- pair (a,b) for open interval
- two-member list [a, b] for closed interval (throws runtime error if the list length is different)

Methods

toInterval :: i -> Interval a

Instances

IsInterval [a] a | Two-element list [a, b] converted to closed interval. No static checking of list length performed.
IsInterval (Interval a) a | Trivial IsInterval instance
IsInterval (a, a) a | Pair (a, b) converted to open interval

data SortOptions s

Options data type for the `sort` command

Constructors

SortOptions |
Fields desc :: Bool sort with descending order limit :: (Int, Int) return (from, to) elements alpha :: Bool sort alphabetically sort_by :: s sort by value from this key get_obj :: [s] return this keys values store :: s store result to this key

data Aggregate

Constructors

SUM |
MIN |
MAX |

Instances

Eq Aggregate |
Show Aggregate |

data RedisKeyType

Constructors

RTNone |
RTString |
RTList |
RTSet |
RTZSet |
RTHash |

Instances

Eq RedisKeyType |
Show RedisKeyType |

type RedisInfo = Map String String

sortDefaults :: SortOptions ByteString

Default options for the `sort` command

fromRInline :: (Monad m, BS s) => Reply s -> m s

Unwraps RInline reply.

Throws an exception when called with something different from RInline

fromRBulk :: (Monad m, BS s) => Reply s -> m (Maybe s)

Unwraps RBulk reply.

Throws an exception when called with something different from RBulk

fromRBulk' :: (Monad m, BS s) => Reply s -> m s

The same as fromRBulk but with fromJust applied

fromRMulti :: (Monad m, BS s) => Reply s -> m (Maybe [Reply s])

Unwraps RMulti reply

Throws an exception when called with something different from RMulti

fromRMultiBulk :: (Monad m, BS s) => Reply s -> m (Maybe [Maybe s])

Unwraps RMulti reply filled with RBulk

Throws an exception when called with something different from RMulti

fromRMultiBulk' :: (Monad m, BS s) => Reply s -> m [s]

The same as fromRMultiBulk but with fromJust applied

fromRInt :: (Monad m, BS s) => Reply s -> m Int

Unwraps RInt reply

Throws an exception when called with something different from RInt

fromROk :: (Monad m, BS s) => Reply s -> m ()

Unwraps ROk reply

Throws an exception when called with something different from ROk

noError :: (Monad m, BS s) => Reply s -> m ()

Unwraps every non-error reply

Throws an exception when called with something different from RMulti

parseMessage :: (Monad m, BS s) => Reply ByteString -> m (Message s)

Parse Reply as a Message

Throws an exception on parse error

takeAll :: (Int, Int)

a (0, -1) range - takes all element from a list in lrange, zrange and so on

# Database connection

localhost :: String

just a localhost

defaultPort :: String

default Redis port

connect

Arguments

:: String | hostname or path to the redis socket
-> String | port or null if unix sockets used
-> IO Redis |

Conects to Redis server and returns connection descriptor

disconnect :: Redis -> IO ()

Close connection

isConnected :: Redis -> IO Bool

Returns True when connection handler is opened

getServer :: Redis -> IO (String, String)

Returns connection host and port

getDatabase :: Redis -> IO Int

Returns currently selected database

renameCommand

Arguments

:: Redis |
-> ByteString | command to rename
-> ByteString | new name
-> IO () |

Adds command to renaming map

# Redis commands

## Generic

ping :: Redis -> IO (Reply ())

ping - pong

RPong returned if no errors happends

auth

Arguments

:: BS s |
=> Redis |
-> s | password
-> IO (Reply ()) |

Password authentication

ROk returned

echo

Arguments

:: BS s |
=> Redis |
-> s | what to echo
-> IO (Reply s) |

Echo the given string

RBulk returned

quit :: Redis -> IO ()

Quit and close connection

shutdown :: Redis -> IO ()

Stop all the clients, save the DB, then quit the server

multi :: Redis -> IO (Reply ())

Begin the multi-exec block

ROk returned

exec :: BS s => Redis -> IO (Reply s)

Execute queued commands

RMulti returned - replies for all executed commands

discard :: Redis -> IO (Reply ())

Discard queued commands without execution

ROk returned

run_multi

Arguments

:: BS s |
=> Redis |
-> (Redis -> IO ()) | IO action to run
-> IO (Reply s) |

Run commands within multi-exec block

RMulti returned - replies for all executed commands

watch

Arguments

:: BS s |
=> Redis |
-> [s] | keys to watch for
-> IO (Reply ()) |

Add keys to a watch list for Check-and-Set operation.

For more information see http://redis.io/topics/transactions

ROk returned

unwatch :: Redis -> IO (Reply ())

Force unwatch all watched keys

For more information see http://redis.io/topics/transactions

ROk returned

run_cas

Arguments

:: BS s1 |
=> Redis |
-> [s1] | keys watched
-> (Redis -> IO a) | action to run
-> IO a |

Run actions in a CAS manner

You have to explicitly add multi/exec commands to an appropriate place in an action sequence. Command sequence will be explicitly terminated with unwatch command even if exec command was sent.

Result of user-defined action returned

exists

Arguments

:: BS s |
=> Redis |
-> s | target key
-> IO (Reply Int) |

Test if the key exists

(RInt 1) returned if the key exists and (RInt 0) otherwise

del

Arguments

:: BS s |
=> Redis |
-> s | target key
-> IO (Reply Int) |

Remove the key

(RInt 0) returned if no keys were removed or (RInt n) with removed keys count

del_

Arguments

:: BS s |
=> Redis |
-> [s] | target keys list
-> IO (Reply Int) |

Variadic form of DEL

RInt returned - number of deleted keys

getType

Arguments

:: BS s |
=> Redis |
-> s | target key
-> IO RedisKeyType |

Return the type of the value stored at key in form of a string

RedisKeyType returned

keys

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target keys pattern
-> IO (Reply s2) |

Returns all the keys matching the glob-style pattern

RMulti filled with RBulk returned

randomKey :: BS s => Redis -> IO (Reply s)

Return random key name

RBulk returned

rename

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | source key
-> s2 | destination key
-> IO (Reply ()) |

Rename the key. If key with that name exists it'll be overwritten.

ROk returned

renameNx

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | source key
-> s2 | destination key
-> IO (Reply Int) |

Rename the key if no keys with destination name exists.

(RInt 1) returned if key was renamed and (RInt 0) otherwise

dbsize :: Redis -> IO (Reply Int)

Get the number of keys in the currently selected database

RInt returned

expire

Arguments

:: BS s |
=> Redis |
-> s | target key
-> Int | timeout in seconds
-> IO (Reply Int) |

Set an expiration timeout in seconds on the specified key.

For more information see http://redis.io/commands/expire

(RInt 1) returned if timeout was set and (RInt 0) otherwise

expireAt

Arguments

:: BS s |
=> Redis |
-> s | target key
-> Int | expiration time
-> IO (Reply Int) |

Set an expiration time in form of UNIX timestamp on the specified key

For more information see http://redis.io/commands/expireat

(RInt 1) returned if timeout was set and (RInt 0) otherwise

persist

Arguments

:: BS s |
=> Redis |
-> s | target key
-> IO (Reply Int) |

Remove the timeout from a key

(RInt 1) returned if the timeout was removed and (RInt 0) otherwise

ttl

Arguments

:: BS s |
=> Redis |
-> s | target key
-> IO (Reply Int) |

Return the remining time to live of the key or -1 if key has no associated timeout

RInt returned

select

Arguments

:: Redis |
-> Int | database number
-> IO (Reply ()) |

Select the DB with the specified zero-based numeric index

ROk returned

move

Arguments

:: BS s |
=> Redis |
-> s | target key
-> Int | destination database number
-> IO (Reply Int) |

Move the specified key from the currently selected DB to the specified destination DB. If such a key is already exists in the target DB no data modification performed.

(RInt 1) returned if the key was moved and (RInt 0) otherwise

flushDb :: Redis -> IO (Reply ())

Delete all the keys of the currently selected DB

ROk returned

flushAll :: Redis -> IO (Reply ())

Delete all the keys of all the existing databases

ROk returned

info :: Redis -> IO RedisInfo

Returns different information and statistics about the server

for more information see http://redis.io/commands/info

`RedisInfo` returned

## Strings

set

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> s2 | value
-> IO (Reply ()) |

Set the string value as value of the key

ROk returned

setNx

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> s2 | value
-> IO (Reply Int) |

Set the key value if key does not exists

(RInt 1) returned if key was set and (RInt 0) otherwise

setEx

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> Int | timeout in seconds
-> s2 | value
-> IO (Reply ()) |

Atomically sets target key value and assigns expiration time. The same as multi; set key val; expire key seconds; exec but faster.

Arguments order is the same as in Redis protocol.

ROk returned

mSet

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> [(s1, s2)] | (key, value) pairs
-> IO (Reply ()) |

Atomically set multiple keys

ROk returned

mSetNx

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> [(s1, s2)] | (key, value) pairs
-> IO (Reply Int) |

Atomically set multiple keys if none of them exists.

(RInt 1) returned if all keys was set and (RInt 0) otherwise

get

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> IO (Reply s2) |

Get the value of the specified key.

RBulk returned

getSet

Arguments

:: (BS s1, BS s2, BS s3) |
=> Redis |
-> s1 | target key
-> s2 | value
-> IO (Reply s3) |

Atomically set this value and return the old value

RBulk returned

mGet

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> [s1] | target keys
-> IO (Reply s2) |

Get the values of all specified keys

RMulti filled with RBulk replies returned

incr

Arguments

:: BS s |
=> Redis |
-> s | target key
-> IO (Reply Int) |

Increment the key value by one

RInt returned with new key value

incrBy

Arguments

:: BS s |
=> Redis |
-> s | target key
-> Int | increment
-> IO (Reply Int) |

Increment the key value by N

RInt returned with new key value

incrByFloat

Arguments

:: BS s |
=> Redis |
-> s | target key
-> Double | increment
-> IO (Reply Double) |

Increment the key value by N

(RBulk Double) returned with new key value

decr

Arguments

:: BS s |
=> Redis |
-> s | target key
-> IO (Reply Int) |

Decrement the key value by one

RInt returned with new key value

decrBy

Arguments

:: BS s |
=> Redis |
-> s | target key
-> Int | decrement
-> IO (Reply Int) |

Decrement the key value by N

RInt returned with new key value

append

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> s2 | value
-> IO (Reply Int) |

Append string to the string-typed key

RInt returned - the length of resulting string

substr

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> (Int, Int) | (start, end)
-> IO (Reply s2) |

Returns the substring of the string value stored at key, determined by the offsets start and end (both are inclusive). Negative offsets can be used in order to provide an offset starting from the end of the string.

RBulk returned

getrange

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> (Int, Int) | (start, end)
-> IO (Reply s2) |

Returns the substring of the string value stored at key, determined by the offsets start and end (both are inclusive). Negative offsets can be used in order to provide an offset starting from the end of the string.

RBulk returned

setrange

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> Int | offset
-> s2 | value
-> IO (Reply Int) |

Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value. If the offset is larger than the current length of the string at key, the string is padded with zero-bytes to make offset fit. Non-existing keys are considered as empty strings, so this command will make sure it holds a string large enough to be able to set value at offset.

RInt returned - resulting string length.

getbit

Arguments

:: BS s |
=> Redis |
-> s | target key
-> Int | bit offset
-> IO (Reply Int) |

Returns the bit value at offset in the string value stored at key. When offset is beyond the string length, the string is assumed to be a contiguous space with 0 bits. When key does not exist it is assumed to be an empty string, so offset is always out of range and the value is also assumed to be a contiguous space with 0 bits.

RInt returned

setbit

Arguments

:: BS s |
=> Redis |
-> s | target key
-> Int | bit offset
-> Int | bit value - 0 or 1
-> IO (Reply Int) |

Sets or clears the bit at offset in the string value stored at key. For more information see http://redis.io/commands/setbit

RInt returned - the original bit value stored at offset.

strlen

Arguments

:: BS s |
=> Redis |
-> s | target key
-> IO (Reply Int) |

Returns a length of a string-typed key

RInt returned

## Lists

rpush

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> s2 | value
-> IO (Reply Int) |

Add string value to the tail of the list-type key. New list length returned

RInt returned

rpush_

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> [s2] | values list
-> IO (Reply Int) |

Variadic form of rpush

RInt returned

lpush

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> s2 | value
-> IO (Reply Int) |

Add string value to the head of the list-type key. New list length returned

RInt returned

lpush_

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> [s2] | values list
-> IO (Reply Int) |

Variadic form of LPUSH

RInt returned

rpushx

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> s2 | value to push
-> IO (Reply Int) |

Add string value to the tail of existing list-type key. New list length returned. If such a key was not exists, list is not created and (RInt 0) returned.

RInt returned

lpushx

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> s2 | value to push
-> IO (Reply Int) |

Add string value to the head of existing list-type key. New list length returned. If such a key was not exists, list is not created and (RInt 0) returned.

RInt returned

linsert

Arguments

:: (BS s1, BS s2, BS s3) |
=> Redis |
-> s1 | target list
-> LInsertDirection | where to insert - before or after
-> s2 | target element
-> s3 | inserted value
-> IO (Reply Int) |

Inserts value in the list stored at key either before or after the reference value pivot.

RInt returned - resulting list length or (RInt -1) if target element was not found.

llen

Arguments

:: BS s |
=> Redis |
-> s | target key
-> IO (Reply Int) |

Return lenght of the list. Note that for not-existing keys it returns zero length.

RInt returned or RError if key is not a list

lrange

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> (Int, Int) | (from, to) pair
-> IO (Reply s2) |

Return the specified range of list elements. List indexed from 0 to (llen - 1). lrange returns slice including "from" and "to" elements, eg. lrange 0 2 will return the first three elements of the list.

Parameters "from" and "to" may also be negative. If so it will counts as offset from end ot the list. eg. -1 - is the last element of the list, -2 - is the second from the end and so on.

RMulti filled with RBulk returned

ltrim

Arguments

:: BS s |
=> Redis |
-> s | target key
-> (Int, Int) | (from, to) pair
-> IO (Reply ()) |

Trim list so that it will contain only the specified range of elements.

ROk returned

lindex

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> Int | index
-> IO (Reply s2) |

Return the specified element of the list by its index

RBulk returned

lset

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> Int | index
-> s2 | new value
-> IO (Reply ()) |

Set the list's value indexed by an index to the new value

ROk returned if element was set and RError if index is out of range or key is not a list

lrem

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> Int | occurrences
-> s2 | value
-> IO (Reply Int) |

Remove the first count occurrences of the value element from the list

RInt returned - the number of elements removed

lpop

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> IO (Reply s2) |

Atomically return and remove the first element of the list

RBulk returned

rpop

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> IO (Reply s2) |

Atomically return and remove the last element of the list

RBulk returned

rpoplpush

Arguments

:: (BS s1, BS s2, BS s3) |
=> Redis |
-> s1 | source key
-> s2 | destination key
-> IO (Reply s3) |

Atomically return and remove the last (tail) element of the source list, and push the element as the first (head) element of the destination list

RBulk returned

blpop

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> [s1] | keys list
-> Int | timeout
-> IO (Maybe (s1, s2)) |

Blocking lpop

For more information see http://redis.io/commands/blpop

Return (Just (key, value)) if value was successfully popped from key list or Nothing of timeout exceeded.

brpop

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> [s1] | keys list
-> Int | timeout
-> IO (Maybe (s1, s2)) |

Blocking rpop

For more information see http://redis.io/commands/brpop

Return (Just (key, value)) if value was successfully popped from key list or Nothing of timeout exceeded.

brpoplpush

Arguments

:: (BS s1, BS s2, BS s3) |
=> Redis |
-> s1 | source key
-> s2 | destination key
-> Int | timeout
-> IO (Maybe (Maybe s3)) |

Blocking rpoplpush

For more information see http://redis.io/commands/brpoplpush

Return (Just $ Maybe value) if value was successfully popped or Nothing if timeout exceeded.

## Sets

sadd

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> s2 | value
-> IO (Reply Int) |

Add the specified member to the set value stored at key

(RInt 1) returned if element was added and (RInt 0) if element was already a member of the set

sadd_

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> [s2] | values list
-> IO (Reply Int) |

Variadic form of SADD

RInt returned - number of actualy added elements

srem

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> s2 | value
-> IO (Reply Int) |

Remove the specified member from the set value stored at key

(RInt 1) returned if element was removed and (RInt 0) if element is not a member of the set

srem_

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> [s2] | values list
-> IO (Reply Int) |

Variadic form of SREM

RInt returned - number of removed values

spop

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> IO (Reply s2) |

Remove a random element from a Set returning it as return value

RBulk returned

smove

Arguments

:: (BS s1, BS s2, BS s3) |
=> Redis |
-> s1 | source key
-> s2 | destination key
-> s3 | value
-> IO (Reply Int) |

Move the specifided member from one set to another

(RInt 1) returned if element was moved and (RInt 0) if element is not a member of the source set

scard

Arguments

:: BS s |
=> Redis |
-> s | target key
-> IO (Reply Int) |

Return the number of elements of the set. If key doesn't exists 0 returned.

RInt returned

sismember

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> s2 | value to test
-> IO (Reply Int) |

Test if element is member of the set. If key doesn't exists 0 returned.

(RInt 1) returned if element is member of the set and (RInt 0) otherwise

smembers

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> IO (Reply s2) |

Return all the members (elements) of the set

RMulti filled with RBulk returned

srandmember

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> IO (Reply s2) |

Return a random element from a set

RBulk returned

sinter

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> [s1] | keys list
-> IO (Reply s2) |

Return the members of a set resulting from the intersection of all the specifided sets

RMulti filled with RBulk returned

sinterStore

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | where to store resulting set
-> [s2] | sets list
-> IO (Reply ()) |

The same as `sinter` but instead of being returned the resulting set is stored

RInt returned - resulting set cardinality.

sunion

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> [s1] | keys list
-> IO (Reply s2) |

Return the members of a set resulting from the union of all the specifided sets

RMulti filled with RBulk returned

sunionStore

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | where to store resulting set
-> [s2] | sets list
-> IO (Reply ()) |

The same as `sunion` but instead of being returned the resulting set is stored

RInt returned - resulting set cardinality.

sdiff

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> [s1] | keys list
-> IO (Reply s2) |

Return the members of a set resulting from the difference between the first set provided and all the successive sets

RMulti filled with RBulk returned

sdiffStore

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | where to store resulting set
-> [s2] | sets list
-> IO (Reply ()) |

The same as `sdiff` but instead of being returned the resulting set is stored

RInt returned - resulting set cardinality.

## Sorted sets

zadd

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> Double | score
-> s2 | value
-> IO (Reply Int) |

Add the specified member having the specifeid score to the sorted set

(RInt 1) returned if new element was added and (RInt 0) if that element was already a member of the sortet set and the score was updated

zadd_

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> [(Double, s2)] | list of score-value pairs
-> IO (Reply Int) |

Variadic form of zadd

RInt returned - the number of elements actually added. Not including elements which scores was just updated.

zrem

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> s2 | value
-> IO (Reply Int) |

Remove the specified member from the sorted set

(RInt 1) returned if element was removed and (RInt 0) if element was not a member of the sorted set

zrem_

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> [s2] | values list
-> IO (Reply Int) |

Variadic form of zrem RInt returned - the number of removed elements

zincrBy

Arguments

:: (BS s1, BS s2, BS s3) |
=> Redis |
-> s1 | target key
-> Double | increment
-> s2 | value
-> IO (Reply s3) |

If member already 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 exist in the sorted set it is added with increment as score (that is, like if the previous score was virtually zero). The new score of the member is returned.

RBulk returned

zrange

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> (Int, Int) | (from, to) pair
-> Bool | withscores option
-> IO (Reply s2) |

Return the specified elements of the sorted set. Start and end are zero-based indexes. WITHSCORES paramenter indicates if it's needed to return elements with its scores or not. If WITHSCORES is True then the resulting list will be composed of value1, score1, value2, score2 and so on.

RMulti filled with RBulk returned

zrevrange

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> (Int, Int) | (from, to) pair
-> Bool | withscores option
-> IO (Reply s2) |

Return the specified elements of the sorted set at the specified key. The elements are considered sorted from the highest to the lowerest score

RMulti filled with RBulk returned

zrangebyscore

Arguments

:: (IsInterval i Double, BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> i | scores interval
-> Maybe (Int, Int) | limits (offset, count)
-> Bool | withscores option
-> IO (Reply s2) |

Return the all the elements in the sorted set with a score that lays within a given interval

RMulti filled with RBulk returned

zrevrangebyscore :: (IsInterval i Double, BS s1, BS s2) => Redis -> s1 -> i -> Maybe (Int, Int) -> Bool -> IO (Reply s2)

Return the all the elements in the sorted set with a score that lays within a given interval. Elements is ordered from greater score to lower. Interval passed into command must be reversed (first value is greater then second)

RMulti filled with RBulk returned

zcount

Arguments

:: (IsInterval i Double, BS s) |
=> Redis |
-> s | target key
-> i | scores interval
-> IO (Reply Int) |

Count a number of elements of the sorted set with a score that lays within a given interval

RInt returned

zremrangebyscore

Arguments

:: BS s |
=> Redis |
-> s | target key
-> (Double, Double) | (from, to) pair. zremrangebyscore currently doesn't supports open intervals
-> IO (Reply Int) |

Remove all the elements in the sorted set with a score that lays within a given interval. For now this command doesn't supports open and semi-open intervals

RInt returned - the number of elements removed

zcard

Arguments

:: BS s |
=> Redis |
-> s | target key
-> IO (Reply Int) |

Return the sorted set cardinality (number of elements)

RInt returned

zscore

Arguments

:: (BS s1, BS s2, BS s3) |
=> Redis |
-> s1 | target key
-> s2 | value
-> IO (Reply s3) |

Return the score of the specified element of the sorted set

RBulk returned

zrank

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> s2 | value
-> IO (Reply Int) |

Returns the rank of member in the sorted set stored at key, with the scores ordered from low to high.

RInt returned or (RBulk Nothing) if value is not found in set.

zrevrank

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> s2 | value
-> IO (Reply Int) |

Returns the rank of member in the sorted set stored at key, with the scores ordered from high to low.

RInt returned or (RBulk Nothing) if value is not found in set.

zremrangebyrank :: BS s => Redis -> s -> (Int, Int) -> IO (Reply Int)

Remove elements from the sorted set with rank lays within a given interval.

RInt returned - the number of elements removed

zunion :: (BS s1, BS s2) => Redis -> s1 -> [s2] -> [Double] -> Aggregate -> IO (Reply Int)

Deprecated: ZUNION command was renamed to ZUNIONSTORE

zinter :: (BS s1, BS s2) => Redis -> s1 -> [s2] -> [Double] -> Aggregate -> IO (Reply Int)

Deprecated: ZINTER command was renamed to ZINTERSTORE

zunionStore

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | destination key
-> [s2] | sources keys
-> [Double] | weights
-> Aggregate | aggregate
-> IO (Reply Int) |

Create a union of provided sorted sets and store it at destination key

If weights is not null then scores of sorted sets used with corresponding weights. If so lenght of weights must be the same as length of sources.

Aggregate is an option how to aggregate resulting scores.

RInt returned - the number of elements in the resulting set.

zinterStore

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | destination key
-> [s2] | sources keys
-> [Double] | weights
-> Aggregate | aggregate
-> IO (Reply Int) |

Create an intersectoin of provided sorted sets and store it at destination key

If weights is not null then scores of sorted sets used with corresponding weights. If so lenght of weights must be the same as length of sources.

Aggregate is an option how to aggregate resulting scores.

RInt returned - the number of elements in the resulting set.

## Hashes

hset

Arguments

:: (BS s1, BS s2, BS s3) |
=> Redis |
-> s1 | target key
-> s2 | field name
-> s3 | value
-> IO (Reply Int) |

Set the specified hash field to the specified value

(RInt 0 returned if field value was updated and (RInt 1) if new field created

hget

Arguments

:: (BS s1, BS s2, BS s3) |
=> Redis |
-> s1 | key
-> s2 | field name
-> IO (Reply s3) |

Return value associated with specified field from hash

RBulk returned

hdel

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | key
-> s2 | field name
-> IO (Reply Int) |

Remove field from a hash

(RInt 1) returned if field was removed and (RInt 0) otherwise

hdel_

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | key
-> [s2] | field name
-> IO (Reply Int) |

Variadic form of HDEL

RInt returned - number of fields deleted

hmset

Arguments

:: (BS s1, BS s2, BS s3) |
=> Redis |
-> s1 | target key
-> [(s2, s3)] | (field, value) pairs
-> IO (Reply ()) |

Atomically sets multiple fields within a hash-typed key

ROk returned

hmget

Arguments

:: (BS s1, BS s2, BS s3) |
=> Redis |
-> s1 | target key
-> [s2] | field names
-> IO (Reply s3) |

Get the values of all specified fields from the hash-typed key

RMulti filled with RBulk replies returned

hincrBy

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> s2 | field name
-> Int | increment
-> IO (Reply Int) |

Increment the field value within a hash by N

RInt returned with new key value

hincrByFloat

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> s2 | field name
-> Double | increment
-> IO (Reply Double) |

Increment the field value within a hash by N

(RBulk Double) returned with new key value

hexists

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | key
-> s2 | field name
-> IO (Reply Int) |

Test if hash contains the specified field

(RInt 1) returned if fiels exists and (RInt 0) otherwise

hlen :: BS s => Redis -> s -> IO (Reply Int)

Return the number of fields contained in the specified hash

RInt returned

hkeys :: (BS s1, BS s2) => Redis -> s1 -> IO (Reply s2)

Return all the field names the hash holding

RMulti field with RBulk returned

hvals :: (BS s1, BS s2) => Redis -> s1 -> IO (Reply s2)

Return all the associated values the hash holding

RMulti field with RBulk returned

hgetall

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | target key
-> IO (Reply s2) |

Return all the field names and associated values the hash holding in form of [field1, value1, field2, value2...]

RMulti field with RBulk returned. If key doesn't exists (RMulti []) returned.

## Sorting

sort

Arguments

:: (BS s1, BS s2, BS s3) |
=> Redis |
-> s1 | target key
-> SortOptions s2 | options
-> IO (Reply s3) |

Sort the elements contained in the List, Set, or Sorted Set

for more information see http://redis.io/commands/sort

RMulti filled with RBulk returned

listRelated

Arguments

:: (BS s1, BS s2, BS s3) |
=> Redis |
-> s1 | related key
-> s2 | index key
-> (Int, Int) | range
-> IO (Reply s3) |

Shortcut for the `sort` with some `get_obj` and constant `sort_by` options

RMulti filled with RBulk returned

## Publish/Subscribe

subscribed :: Redis -> IO Int

Get a number of subscribed channels on this connection

It doesn't run any redis commands, number of subscribtions is taken from internal connection state

subscribe

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> [s1] | channels to subscribe
-> IO [Message s2] |

Subscribe to channels

list of Message with subscribtion information returned

unsubscribe

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> [s1] | channels to unsubscribe
-> IO [Message s2] |

Unsubscribe from channels. If called with an empty list then unsubscribe all channels

list of Message with subscribtion information returned

psubscribe

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> [s1] | patterns to subscribe
-> IO [Message s2] |

Subscribe to patterns

list of Message with subscribtion information returned

punsubscribe

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> [s1] | patterns to unsubscribe
-> IO [Message s2] |

Unsubscribe from patterns. If called with an empty list then unsubscribe all patterns

list of Message with subscribtion information returned

publish

Arguments

:: (BS s1, BS s2) |
=> Redis |
-> s1 | channel
-> s2 | message
-> IO (Reply Int) |

Publish message to target channel

RInt returned - a number of clients that recieves the message

listen

Arguments

:: BS s |
=> Redis |
-> Int | timeout
-> IO (Maybe (Message s)) |

Wait for a messages.

Just Message returned or Nothing if timeout exceeded

## Persistent control

save :: Redis -> IO (Reply ())

Save the whole dataset on disk

ROk returned

bgsave :: Redis -> IO (Reply ())

Save the DB in background

ROk returned

lastsave :: Redis -> IO (Reply Int)

Return the UNIX TIME of the last DB save executed with success

RInt returned

bgrewriteaof :: Redis -> IO (Reply ())

Rewrites the Append Only File in background

ROk returned