redis-io-0.7.0: Yet another redis client.

Safe HaskellNone




Redis client

class (Functor m, Applicative m, Monad m, MonadIO m, MonadCatch m) => MonadClient m where Source

Monads in which Client actions may be embedded.


liftClient :: Client a -> m a Source

Lift a computation to the Client monad.

runRedis :: MonadIO m => Pool -> Client a -> m a Source

commands :: MonadClient m => Redis IO a -> m a Source

Execute the given redis commands pipelined, i.e. commands are send in batches to the server and the responses are fetched and parsed after a full batch has been sent. A failing command which produces a RedisError will not prevent subsequent commands from being executed by the redis server. However the first error will be thrown as an exception. To force sending see sync.

pubSub :: MonadClient m => (Maybe ByteString -> ByteString -> ByteString -> PubSub IO ()) -> PubSub IO () -> m () Source

Execute the given publish/subscribe commands. The first parameter is the callback function which will be invoked with a possible pattern (if PSUBSCRIBE was used), channel, and message, once messages arrive.

Connection pool

data Pool Source

Connection pool.

shutdown :: MonadIO m => Pool -> m () Source

Client and pool settings

defSettings :: Settings Source

Default settings.

  • host = localhost
  • port = 6379
  • idle timeout = 60s
  • stripes = 2
  • connections per stripe = 25
  • connect timeout = 5s
  • send-receive timeout = 10s

setMaxConnections :: Int -> Settings -> Settings Source

Maximum connections per pool stripe.

setConnectTimeout :: NominalDiffTime -> Settings -> Settings Source

When a pool connection is opened, connect timeout is the maximum time we are willing to wait for the connection attempt to the redis server to succeed.


data ConnectionError Source



All connections are in use.


The connection has been closed unexpectedly.


Connecting to redis server took too long.

newtype InternalError Source

General error, e.g. parsing redis responses failed.


InternalError String 

newtype Timeout Source

A single send-receive cycle took too long.


Timeout String 

data TransactionFailure Source

An exception thrown on transaction failures.



A WATCHed key changed conccurrently.


The transaction was DISCARDed.

TransactionFailure String

Other transaction failure.