Safe Haskell | None |
---|---|
Language | Haskell2010 |
Database.Redis.IO
- data Client a
- runRedis :: MonadIO m => Pool -> Client a -> m a
- stepwise :: Redis IO a -> Client a
- pipelined :: Redis IO a -> Client a
- pubSub :: (ByteString -> ByteString -> PubSub IO ()) -> PubSub IO () -> Client ()
- data Pool
- mkPool :: MonadIO m => Logger -> Settings -> m Pool
- shutdown :: MonadIO m => Pool -> m ()
- data Settings
- defSettings :: Settings
- setHost :: String -> Settings -> Settings
- setPort :: Word16 -> Settings -> Settings
- setIdleTimeout :: NominalDiffTime -> Settings -> Settings
- setMaxConnections :: Int -> Settings -> Settings
- setMaxWaitQueue :: Word64 -> Settings -> Settings
- setPoolStripes :: Int -> Settings -> Settings
- setConnectTimeout :: NominalDiffTime -> Settings -> Settings
- setSendRecvTimeout :: NominalDiffTime -> Settings -> Settings
- data ConnectionError
- data InternalError = InternalError String
- data Timeout = Timeout String
- module Data.Redis.Command
Redis client
Redis client monad.
stepwise :: Redis IO a -> Client a Source
Execute the given redis commands stepwise. I.e. every
command is send to the server and the response fetched and parsed before
the next command. A failing command which produces a RedisError
will
interrupt the command sequence and the error will be thrown as an
exception.
pipelined :: Redis IO a -> Client 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.
pubSub :: (ByteString -> ByteString -> PubSub IO ()) -> PubSub IO () -> Client () Source
Execute the given publish/subscribe commands. The first parameter is the callback function which will be invoked with channel and message once messages arrive.
Connection pool
Client and pool settings
defSettings :: Settings Source
Default settings.
- host = localhost
- port = 6379
- idle timeout = 60s
- stripes = 2
- connections per stripe = 25
- max. wait queue = unbounded
- connect timeout = 5s
- send-receive timeout = 10s
setIdleTimeout :: NominalDiffTime -> Settings -> Settings Source
setMaxConnections :: Int -> Settings -> Settings Source
Maximum connections per pool stripe.
setMaxWaitQueue :: Word64 -> Settings -> Settings Source
Maximum length of the wait queue, i.e. the queue where attempts to
acquire a connection from the pool build up if all connections are in
use. If the maximum length has been reached, attempting to acquire
a connection will cause a ConnectionsBusy
ConnectionError
.
setPoolStripes :: Int -> Settings -> Settings Source
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 and wait queue is full. |
ConnectionClosed | The connection has been closed unexpectedly. |
ConnectTimeout | Connecting to redis server took too long. |
data InternalError Source
General error, e.g. parsing redis responses failed.
Constructors
InternalError String |
Instances
A single send-receive cycle took too long.
Re-exports
module Data.Redis.Command