redis-io-1.0.0: Yet another redis client.

Safe HaskellNone
LanguageHaskell2010

Database.Redis.IO

Contents

Synopsis

Redis client

data Client a Source #

Redis client monad.

Instances
Monad Client Source # 
Instance details

Defined in Database.Redis.IO.Client

Methods

(>>=) :: Client a -> (a -> Client b) -> Client b #

(>>) :: Client a -> Client b -> Client b #

return :: a -> Client a #

fail :: String -> Client a #

Functor Client Source # 
Instance details

Defined in Database.Redis.IO.Client

Methods

fmap :: (a -> b) -> Client a -> Client b #

(<$) :: a -> Client b -> Client a #

Applicative Client Source # 
Instance details

Defined in Database.Redis.IO.Client

Methods

pure :: a -> Client a #

(<*>) :: Client (a -> b) -> Client a -> Client b #

liftA2 :: (a -> b -> c) -> Client a -> Client b -> Client c #

(*>) :: Client a -> Client b -> Client b #

(<*) :: Client a -> Client b -> Client a #

MonadIO Client Source # 
Instance details

Defined in Database.Redis.IO.Client

Methods

liftIO :: IO a -> Client a #

MonadThrow Client Source # 
Instance details

Defined in Database.Redis.IO.Client

Methods

throwM :: Exception e => e -> Client a #

MonadCatch Client Source # 
Instance details

Defined in Database.Redis.IO.Client

Methods

catch :: Exception e => Client a -> (e -> Client a) -> Client a #

MonadMask Client Source # 
Instance details

Defined in Database.Redis.IO.Client

Methods

mask :: ((forall a. Client a -> Client a) -> Client b) -> Client b #

uninterruptibleMask :: ((forall a. Client a -> Client a) -> Client b) -> Client b #

generalBracket :: Client a -> (a -> ExitCase b -> Client c) -> (a -> Client b) -> Client (b, c) #

MonadLogger Client Source # 
Instance details

Defined in Database.Redis.IO.Client

Methods

log :: Level -> (Msg -> Msg) -> Client () #

MonadClient Client Source # 
Instance details

Defined in Database.Redis.IO.Client

Methods

liftClient :: Client a -> Client a Source #

MonadBase IO Client Source # 
Instance details

Defined in Database.Redis.IO.Client

Methods

liftBase :: IO α -> Client α #

MonadBaseControl IO Client Source # 
Instance details

Defined in Database.Redis.IO.Client

Associated Types

type StM Client a :: * #

Methods

liftBaseWith :: (RunInBase Client IO -> IO a) -> Client a #

restoreM :: StM Client a -> Client a #

MonadReader Pool Client Source # 
Instance details

Defined in Database.Redis.IO.Client

Methods

ask :: Client Pool #

local :: (Pool -> Pool) -> Client a -> Client a #

reader :: (Pool -> a) -> Client a #

type StM Client a Source # 
Instance details

Defined in Database.Redis.IO.Client

type StM Client a = StM (ReaderT Pool IO) a

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

Monads in which Client actions may be embedded.

Minimal complete definition

liftClient

Methods

liftClient :: Client a -> m a Source #

Lift a computation to the Client monad.

Instances
MonadClient Client Source # 
Instance details

Defined in Database.Redis.IO.Client

Methods

liftClient :: Client a -> Client a Source #

MonadClient m => MonadClient (ExceptT e m) Source # 
Instance details

Defined in Database.Redis.IO.Client

Methods

liftClient :: Client a -> ExceptT e m a Source #

MonadClient m => MonadClient (StateT s m) Source # 
Instance details

Defined in Database.Redis.IO.Client

Methods

liftClient :: Client a -> StateT s m a Source #

MonadClient m => MonadClient (StateT s m) Source # 
Instance details

Defined in Database.Redis.IO.Client

Methods

liftClient :: Client a -> StateT s m a Source #

MonadClient m => MonadClient (ReaderT r m) Source # 
Instance details

Defined in Database.Redis.IO.Client

Methods

liftClient :: Client a -> ReaderT r m a Source #

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.

Instances
MonadReader Pool Client Source # 
Instance details

Defined in Database.Redis.IO.Client

Methods

ask :: Client Pool #

local :: (Pool -> Pool) -> Client a -> Client a #

reader :: (Pool -> a) -> Client a #

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.

Exceptions

data ConnectionError Source #

Constructors

ConnectionsBusy

All connections are in use.

ConnectionClosed

The connection has been closed unexpectedly.

ConnectTimeout

Connecting to redis server took too long.

newtype InternalError Source #

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

Constructors

InternalError String 

newtype Timeout Source #

A single send-receive cycle took too long.

Constructors

Timeout String 

data TransactionFailure Source #

An exception thrown on transaction failures.

Constructors

TransactionAborted

A WATCHed key changed conccurrently.

TransactionDiscarded

The transaction was DISCARDed.

TransactionFailure String

Other transaction failure.

Re-exports