| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Database.Redis.Core
Synopsis
- data Redis a
- unRedis :: Redis a -> ReaderT RedisEnv IO a
- reRedis :: ReaderT RedisEnv IO a -> Redis a
- class MonadRedis m => RedisCtx (m :: Type -> Type) (f :: Type -> Type) | m -> f where
- returnDecode :: RedisResult a => Reply -> m (f a)
- class Monad m => MonadRedis (m :: Type -> Type) where
- data Hooks = Hooks {}
- type SendRequestHook = ([ByteString] -> IO Reply) -> [ByteString] -> IO Reply
- type SendPubSubHook = ([ByteString] -> IO ()) -> [ByteString] -> IO ()
- type CallbackHook = (Message -> IO PubSub) -> Message -> IO PubSub
- type SendHook = (ByteString -> IO ()) -> ByteString -> IO ()
- type ReceiveHook = IO Reply -> IO Reply
- send :: MonadRedis m => [ByteString] -> m ()
- recv :: MonadRedis m => m Reply
- sendRequest :: (RedisCtx m f, RedisResult a) => [ByteString] -> m (f a)
- runRedisInternal :: Connection -> Redis a -> IO a
- runRedisClusteredInternal :: Connection -> IO ShardMap -> Redis a -> IO a
- defaultHooks :: Hooks
- data RedisEnv
- = NonClusteredEnv { }
- | ClusteredEnv { }
Documentation
Context for normal command execution, outside of transactions. Use
runRedis to run actions of this type.
In this context, each result is wrapped in an Either to account for the
possibility of Redis returning an Error reply.
Instances
| MonadIO Redis Source # | |
Defined in Database.Redis.Core.Internal | |
| MonadCatch Redis Source # | |
Defined in Database.Redis.Core.Internal | |
| MonadMask Redis Source # | |
Defined in Database.Redis.Core.Internal Methods mask :: HasCallStack => ((forall a. Redis a -> Redis a) -> Redis b) -> Redis b # uninterruptibleMask :: HasCallStack => ((forall a. Redis a -> Redis a) -> Redis b) -> Redis b # generalBracket :: HasCallStack => Redis a -> (a -> ExitCase b -> Redis c) -> (a -> Redis b) -> Redis (b, c) # | |
| MonadThrow Redis Source # | |
Defined in Database.Redis.Core.Internal Methods throwM :: (HasCallStack, Exception e) => e -> Redis a # | |
| Applicative Redis Source # | |
| Functor Redis Source # | |
| Monad Redis Source # | |
| MonadFail Redis Source # | |
Defined in Database.Redis.Core.Internal | |
| MonadRedis Redis Source # | |
| MonadUnliftIO Redis Source # | |
Defined in Database.Redis.Core.Internal | |
| RedisCtx Redis (Either Reply) Source # | |
Defined in Database.Redis.Core Methods returnDecode :: RedisResult a => Reply -> Redis (Either Reply a) Source # | |
class MonadRedis m => RedisCtx (m :: Type -> Type) (f :: Type -> Type) | m -> f where Source #
This class captures the following behaviour: In a context m, a command
will return its result wrapped in a "container" of type f.
Please refer to the Command Type Signatures section of this page for more information.
Methods
returnDecode :: RedisResult a => Reply -> m (f a) Source #
Instances
| RedisCtx RedisTx Queued Source # | |
Defined in Database.Redis.Transactions Methods returnDecode :: RedisResult a => Reply -> RedisTx (Queued a) Source # | |
| RedisCtx Redis (Either Reply) Source # | |
Defined in Database.Redis.Core Methods returnDecode :: RedisResult a => Reply -> Redis (Either Reply a) Source # | |
class Monad m => MonadRedis (m :: Type -> Type) where Source #
Instances
| MonadRedis Redis Source # | |
| MonadRedis RedisTx Source # | |
| (MonadTrans t, MonadRedis m, Monad (t m)) => MonadRedis (t m) Source # | |
Defined in Database.Redis.Core | |
A collection of hook functions used by a connection.
Constructors
| Hooks | |
Fields | |
type SendRequestHook = ([ByteString] -> IO Reply) -> [ByteString] -> IO Reply Source #
A hook for sending commands to the server and receiving replies from the server.
This wraps the command-level request path used by most Redis commands.
type SendPubSubHook = ([ByteString] -> IO ()) -> [ByteString] -> IO () Source #
A hook for sending pub/sub messages to the server.
type CallbackHook = (Message -> IO PubSub) -> Message -> IO PubSub Source #
A hook for invoking callbacks with pub/sub messages.
type SendHook = (ByteString -> IO ()) -> ByteString -> IO () Source #
A hook for sending raw bytes to the server.
This sits below request rendering and can be used to observe the exact wire payload sent on the socket.
send :: MonadRedis m => [ByteString] -> m () Source #
recv :: MonadRedis m => m Reply Source #
sendRequest :: (RedisCtx m f, RedisResult a) => [ByteString] -> m (f a) Source #
sendRequest can be used to implement commands from experimental
versions of Redis. An example of how to implement a command is given
below.
-- |Redis DEBUG OBJECT command debugObject :: ByteString ->Redis(EitherReplyByteString) debugObject key =sendRequest["DEBUG", "OBJECT", key]
runRedisInternal :: Connection -> Redis a -> IO a Source #
Internal version of runRedis that does not depend on the Connection
abstraction. Used to run the AUTH command when connecting.
runRedisClusteredInternal :: Connection -> IO ShardMap -> Redis a -> IO a Source #
defaultHooks :: Hooks Source #
The default hooks.
Every hook is the identity function, so installing defaultHooks has no
effect on behavior.
Constructors
| NonClusteredEnv | |
Fields | |
| ClusteredEnv | |
Fields | |