hask-redis-mux:redis
Safe HaskellNone
LanguageGHC2021

Database.Redis

Description

Convenience re-export module for the hask-redis-mux library.

Import this single module for both standalone and cluster Redis usage.

Standalone usage with bracket pattern (recommended):

{-# LANGUAGE OverloadedStrings #-}
import Database.Redis

main :: IO ()
main = do
  result <- runRedis defaultStandaloneConfig $ do
    set "mykey" "myvalue"
    (val :: ByteString) <- get "mykey"
    return val
  print result

Typed returns via FromResp:

runRedis defaultStandaloneConfig $ do
  set "counter" "42"
  (n :: Integer) <- get "counter"  -- automatically parsed
  (bs :: ByteString) <- get "counter"  -- raw bytes
  (mt :: Maybe Text) <- get "missing"  -- Nothing for missing keys

Cluster usage with bracket pattern:

withClusterClient clusterConfig connector $ \client ->
  runClusterCommandClient client $ do
    set "mykey" "myvalue"
    get "mykey"

Since: 0.1.0.0

Synopsis

RESP Protocol

class Encodable a where #

Methods

encode :: a -> Builder #

Instances

Instances details
Encodable RespData 
Instance details

Defined in Database.Redis.Resp

Methods

encode :: RespData -> Builder #

Transport

class Client (client :: ConnectionStatus -> Type) where #

Minimal complete definition

connect, close, send, receive

Methods

connect :: MonadIO m => client 'NotConnected -> m (client 'Connected) #

close :: MonadIO m => client 'Connected -> m () #

send :: MonadIO m => client 'Connected -> ByteString -> m () #

sendChunks :: MonadIO m => client 'Connected -> [ByteString] -> m () #

receive :: (MonadIO m, MonadFail m) => client 'Connected -> m ByteString #

Redis Commands

class MonadIO m => RedisCommands (m :: Type -> Type) where #

Methods

auth :: FromResp a => ByteString -> ByteString -> m a #

ping :: FromResp a => m a #

set :: FromResp a => ByteString -> ByteString -> m a #

get :: FromResp a => ByteString -> m a #

mget :: FromResp a => [ByteString] -> m a #

setnx :: FromResp a => ByteString -> ByteString -> m a #

decr :: FromResp a => ByteString -> m a #

psetex :: FromResp a => ByteString -> Int -> ByteString -> m a #

bulkSet :: FromResp a => [(ByteString, ByteString)] -> m a #

flushAll :: FromResp a => m a #

dbsize :: FromResp a => m a #

del :: FromResp a => [ByteString] -> m a #

exists :: FromResp a => [ByteString] -> m a #

incr :: FromResp a => ByteString -> m a #

hset :: FromResp a => ByteString -> ByteString -> ByteString -> m a #

hget :: FromResp a => ByteString -> ByteString -> m a #

hmget :: FromResp a => ByteString -> [ByteString] -> m a #

hexists :: FromResp a => ByteString -> ByteString -> m a #

lpush :: FromResp a => ByteString -> [ByteString] -> m a #

lrange :: FromResp a => ByteString -> Int -> Int -> m a #

expire :: FromResp a => ByteString -> Int -> m a #

ttl :: FromResp a => ByteString -> m a #

rpush :: FromResp a => ByteString -> [ByteString] -> m a #

lpop :: FromResp a => ByteString -> m a #

rpop :: FromResp a => ByteString -> m a #

sadd :: FromResp a => ByteString -> [ByteString] -> m a #

smembers :: FromResp a => ByteString -> m a #

scard :: FromResp a => ByteString -> m a #

sismember :: FromResp a => ByteString -> ByteString -> m a #

hdel :: FromResp a => ByteString -> [ByteString] -> m a #

hkeys :: FromResp a => ByteString -> m a #

hvals :: FromResp a => ByteString -> m a #

llen :: FromResp a => ByteString -> m a #

lindex :: FromResp a => ByteString -> Int -> m a #

clientSetInfo :: FromResp a => [ByteString] -> m a #

clientReply :: ClientReplyValues -> m (Maybe RespData) #

zadd :: FromResp a => ByteString -> [(Int, ByteString)] -> m a #

zrange :: FromResp a => ByteString -> Int -> Int -> Bool -> m a #

geoadd :: FromResp a => ByteString -> [(Double, Double, ByteString)] -> m a #

geodist :: FromResp a => ByteString -> ByteString -> ByteString -> Maybe GeoUnit -> m a #

geohash :: FromResp a => ByteString -> [ByteString] -> m a #

geopos :: FromResp a => ByteString -> [ByteString] -> m a #

georadius :: FromResp a => ByteString -> Double -> Double -> Double -> GeoUnit -> [GeoRadiusFlag] -> m a #

georadiusRo :: FromResp a => ByteString -> Double -> Double -> Double -> GeoUnit -> [GeoRadiusFlag] -> m a #

georadiusByMember :: FromResp a => ByteString -> ByteString -> Double -> GeoUnit -> [GeoRadiusFlag] -> m a #

georadiusByMemberRo :: FromResp a => ByteString -> ByteString -> Double -> GeoUnit -> [GeoRadiusFlag] -> m a #

geosearch :: FromResp a => ByteString -> GeoSearchFrom -> GeoSearchBy -> [GeoSearchOption] -> m a #

geosearchstore :: FromResp a => ByteString -> ByteString -> GeoSearchFrom -> GeoSearchBy -> [GeoSearchOption] -> Bool -> m a #

clusterSlots :: FromResp a => m a #

Instances

Instances details
RedisCommands StandaloneCommandClient 
Instance details

Defined in Database.Redis.Standalone

Methods

auth :: FromResp a => ByteString -> ByteString -> StandaloneCommandClient a #

ping :: FromResp a => StandaloneCommandClient a #

set :: FromResp a => ByteString -> ByteString -> StandaloneCommandClient a #

get :: FromResp a => ByteString -> StandaloneCommandClient a #

mget :: FromResp a => [ByteString] -> StandaloneCommandClient a #

setnx :: FromResp a => ByteString -> ByteString -> StandaloneCommandClient a #

decr :: FromResp a => ByteString -> StandaloneCommandClient a #

psetex :: FromResp a => ByteString -> Int -> ByteString -> StandaloneCommandClient a #

bulkSet :: FromResp a => [(ByteString, ByteString)] -> StandaloneCommandClient a #

flushAll :: FromResp a => StandaloneCommandClient a #

dbsize :: FromResp a => StandaloneCommandClient a #

del :: FromResp a => [ByteString] -> StandaloneCommandClient a #

exists :: FromResp a => [ByteString] -> StandaloneCommandClient a #

incr :: FromResp a => ByteString -> StandaloneCommandClient a #

hset :: FromResp a => ByteString -> ByteString -> ByteString -> StandaloneCommandClient a #

hget :: FromResp a => ByteString -> ByteString -> StandaloneCommandClient a #

hmget :: FromResp a => ByteString -> [ByteString] -> StandaloneCommandClient a #

hexists :: FromResp a => ByteString -> ByteString -> StandaloneCommandClient a #

lpush :: FromResp a => ByteString -> [ByteString] -> StandaloneCommandClient a #

lrange :: FromResp a => ByteString -> Int -> Int -> StandaloneCommandClient a #

expire :: FromResp a => ByteString -> Int -> StandaloneCommandClient a #

ttl :: FromResp a => ByteString -> StandaloneCommandClient a #

rpush :: FromResp a => ByteString -> [ByteString] -> StandaloneCommandClient a #

lpop :: FromResp a => ByteString -> StandaloneCommandClient a #

rpop :: FromResp a => ByteString -> StandaloneCommandClient a #

sadd :: FromResp a => ByteString -> [ByteString] -> StandaloneCommandClient a #

smembers :: FromResp a => ByteString -> StandaloneCommandClient a #

scard :: FromResp a => ByteString -> StandaloneCommandClient a #

sismember :: FromResp a => ByteString -> ByteString -> StandaloneCommandClient a #

hdel :: FromResp a => ByteString -> [ByteString] -> StandaloneCommandClient a #

hkeys :: FromResp a => ByteString -> StandaloneCommandClient a #

hvals :: FromResp a => ByteString -> StandaloneCommandClient a #

llen :: FromResp a => ByteString -> StandaloneCommandClient a #

lindex :: FromResp a => ByteString -> Int -> StandaloneCommandClient a #

clientSetInfo :: FromResp a => [ByteString] -> StandaloneCommandClient a #

clientReply :: ClientReplyValues -> StandaloneCommandClient (Maybe RespData) #

zadd :: FromResp a => ByteString -> [(Int, ByteString)] -> StandaloneCommandClient a #

zrange :: FromResp a => ByteString -> Int -> Int -> Bool -> StandaloneCommandClient a #

geoadd :: FromResp a => ByteString -> [(Double, Double, ByteString)] -> StandaloneCommandClient a #

geodist :: FromResp a => ByteString -> ByteString -> ByteString -> Maybe GeoUnit -> StandaloneCommandClient a #

geohash :: FromResp a => ByteString -> [ByteString] -> StandaloneCommandClient a #

geopos :: FromResp a => ByteString -> [ByteString] -> StandaloneCommandClient a #

georadius :: FromResp a => ByteString -> Double -> Double -> Double -> GeoUnit -> [GeoRadiusFlag] -> StandaloneCommandClient a #

georadiusRo :: FromResp a => ByteString -> Double -> Double -> Double -> GeoUnit -> [GeoRadiusFlag] -> StandaloneCommandClient a #

georadiusByMember :: FromResp a => ByteString -> ByteString -> Double -> GeoUnit -> [GeoRadiusFlag] -> StandaloneCommandClient a #

georadiusByMemberRo :: FromResp a => ByteString -> ByteString -> Double -> GeoUnit -> [GeoRadiusFlag] -> StandaloneCommandClient a #

geosearch :: FromResp a => ByteString -> GeoSearchFrom -> GeoSearchBy -> [GeoSearchOption] -> StandaloneCommandClient a #

geosearchstore :: FromResp a => ByteString -> ByteString -> GeoSearchFrom -> GeoSearchBy -> [GeoSearchOption] -> Bool -> StandaloneCommandClient a #

clusterSlots :: FromResp a => StandaloneCommandClient a #

Client client => RedisCommands (ClusterCommandClient client) 
Instance details

Defined in Database.Redis.Cluster.Client

Methods

auth :: FromResp a => ByteString -> ByteString -> ClusterCommandClient client a #

ping :: FromResp a => ClusterCommandClient client a #

set :: FromResp a => ByteString -> ByteString -> ClusterCommandClient client a #

get :: FromResp a => ByteString -> ClusterCommandClient client a #

mget :: FromResp a => [ByteString] -> ClusterCommandClient client a #

setnx :: FromResp a => ByteString -> ByteString -> ClusterCommandClient client a #

decr :: FromResp a => ByteString -> ClusterCommandClient client a #

psetex :: FromResp a => ByteString -> Int -> ByteString -> ClusterCommandClient client a #

bulkSet :: FromResp a => [(ByteString, ByteString)] -> ClusterCommandClient client a #

flushAll :: FromResp a => ClusterCommandClient client a #

dbsize :: FromResp a => ClusterCommandClient client a #

del :: FromResp a => [ByteString] -> ClusterCommandClient client a #

exists :: FromResp a => [ByteString] -> ClusterCommandClient client a #

incr :: FromResp a => ByteString -> ClusterCommandClient client a #

hset :: FromResp a => ByteString -> ByteString -> ByteString -> ClusterCommandClient client a #

hget :: FromResp a => ByteString -> ByteString -> ClusterCommandClient client a #

hmget :: FromResp a => ByteString -> [ByteString] -> ClusterCommandClient client a #

hexists :: FromResp a => ByteString -> ByteString -> ClusterCommandClient client a #

lpush :: FromResp a => ByteString -> [ByteString] -> ClusterCommandClient client a #

lrange :: FromResp a => ByteString -> Int -> Int -> ClusterCommandClient client a #

expire :: FromResp a => ByteString -> Int -> ClusterCommandClient client a #

ttl :: FromResp a => ByteString -> ClusterCommandClient client a #

rpush :: FromResp a => ByteString -> [ByteString] -> ClusterCommandClient client a #

lpop :: FromResp a => ByteString -> ClusterCommandClient client a #

rpop :: FromResp a => ByteString -> ClusterCommandClient client a #

sadd :: FromResp a => ByteString -> [ByteString] -> ClusterCommandClient client a #

smembers :: FromResp a => ByteString -> ClusterCommandClient client a #

scard :: FromResp a => ByteString -> ClusterCommandClient client a #

sismember :: FromResp a => ByteString -> ByteString -> ClusterCommandClient client a #

hdel :: FromResp a => ByteString -> [ByteString] -> ClusterCommandClient client a #

hkeys :: FromResp a => ByteString -> ClusterCommandClient client a #

hvals :: FromResp a => ByteString -> ClusterCommandClient client a #

llen :: FromResp a => ByteString -> ClusterCommandClient client a #

lindex :: FromResp a => ByteString -> Int -> ClusterCommandClient client a #

clientSetInfo :: FromResp a => [ByteString] -> ClusterCommandClient client a #

clientReply :: ClientReplyValues -> ClusterCommandClient client (Maybe RespData) #

zadd :: FromResp a => ByteString -> [(Int, ByteString)] -> ClusterCommandClient client a #

zrange :: FromResp a => ByteString -> Int -> Int -> Bool -> ClusterCommandClient client a #

geoadd :: FromResp a => ByteString -> [(Double, Double, ByteString)] -> ClusterCommandClient client a #

geodist :: FromResp a => ByteString -> ByteString -> ByteString -> Maybe GeoUnit -> ClusterCommandClient client a #

geohash :: FromResp a => ByteString -> [ByteString] -> ClusterCommandClient client a #

geopos :: FromResp a => ByteString -> [ByteString] -> ClusterCommandClient client a #

georadius :: FromResp a => ByteString -> Double -> Double -> Double -> GeoUnit -> [GeoRadiusFlag] -> ClusterCommandClient client a #

georadiusRo :: FromResp a => ByteString -> Double -> Double -> Double -> GeoUnit -> [GeoRadiusFlag] -> ClusterCommandClient client a #

georadiusByMember :: FromResp a => ByteString -> ByteString -> Double -> GeoUnit -> [GeoRadiusFlag] -> ClusterCommandClient client a #

georadiusByMemberRo :: FromResp a => ByteString -> ByteString -> Double -> GeoUnit -> [GeoRadiusFlag] -> ClusterCommandClient client a #

geosearch :: FromResp a => ByteString -> GeoSearchFrom -> GeoSearchBy -> [GeoSearchOption] -> ClusterCommandClient client a #

geosearchstore :: FromResp a => ByteString -> ByteString -> GeoSearchFrom -> GeoSearchBy -> [GeoSearchOption] -> Bool -> ClusterCommandClient client a #

clusterSlots :: FromResp a => ClusterCommandClient client a #

Client client => RedisCommands (RedisCommandClient client) 
Instance details

Defined in Database.Redis.Command

Methods

auth :: FromResp a => ByteString -> ByteString -> RedisCommandClient client a #

ping :: FromResp a => RedisCommandClient client a #

set :: FromResp a => ByteString -> ByteString -> RedisCommandClient client a #

get :: FromResp a => ByteString -> RedisCommandClient client a #

mget :: FromResp a => [ByteString] -> RedisCommandClient client a #

setnx :: FromResp a => ByteString -> ByteString -> RedisCommandClient client a #

decr :: FromResp a => ByteString -> RedisCommandClient client a #

psetex :: FromResp a => ByteString -> Int -> ByteString -> RedisCommandClient client a #

bulkSet :: FromResp a => [(ByteString, ByteString)] -> RedisCommandClient client a #

flushAll :: FromResp a => RedisCommandClient client a #

dbsize :: FromResp a => RedisCommandClient client a #

del :: FromResp a => [ByteString] -> RedisCommandClient client a #

exists :: FromResp a => [ByteString] -> RedisCommandClient client a #

incr :: FromResp a => ByteString -> RedisCommandClient client a #

hset :: FromResp a => ByteString -> ByteString -> ByteString -> RedisCommandClient client a #

hget :: FromResp a => ByteString -> ByteString -> RedisCommandClient client a #

hmget :: FromResp a => ByteString -> [ByteString] -> RedisCommandClient client a #

hexists :: FromResp a => ByteString -> ByteString -> RedisCommandClient client a #

lpush :: FromResp a => ByteString -> [ByteString] -> RedisCommandClient client a #

lrange :: FromResp a => ByteString -> Int -> Int -> RedisCommandClient client a #

expire :: FromResp a => ByteString -> Int -> RedisCommandClient client a #

ttl :: FromResp a => ByteString -> RedisCommandClient client a #

rpush :: FromResp a => ByteString -> [ByteString] -> RedisCommandClient client a #

lpop :: FromResp a => ByteString -> RedisCommandClient client a #

rpop :: FromResp a => ByteString -> RedisCommandClient client a #

sadd :: FromResp a => ByteString -> [ByteString] -> RedisCommandClient client a #

smembers :: FromResp a => ByteString -> RedisCommandClient client a #

scard :: FromResp a => ByteString -> RedisCommandClient client a #

sismember :: FromResp a => ByteString -> ByteString -> RedisCommandClient client a #

hdel :: FromResp a => ByteString -> [ByteString] -> RedisCommandClient client a #

hkeys :: FromResp a => ByteString -> RedisCommandClient client a #

hvals :: FromResp a => ByteString -> RedisCommandClient client a #

llen :: FromResp a => ByteString -> RedisCommandClient client a #

lindex :: FromResp a => ByteString -> Int -> RedisCommandClient client a #

clientSetInfo :: FromResp a => [ByteString] -> RedisCommandClient client a #

clientReply :: ClientReplyValues -> RedisCommandClient client (Maybe RespData) #

zadd :: FromResp a => ByteString -> [(Int, ByteString)] -> RedisCommandClient client a #

zrange :: FromResp a => ByteString -> Int -> Int -> Bool -> RedisCommandClient client a #

geoadd :: FromResp a => ByteString -> [(Double, Double, ByteString)] -> RedisCommandClient client a #

geodist :: FromResp a => ByteString -> ByteString -> ByteString -> Maybe GeoUnit -> RedisCommandClient client a #

geohash :: FromResp a => ByteString -> [ByteString] -> RedisCommandClient client a #

geopos :: FromResp a => ByteString -> [ByteString] -> RedisCommandClient client a #

georadius :: FromResp a => ByteString -> Double -> Double -> Double -> GeoUnit -> [GeoRadiusFlag] -> RedisCommandClient client a #

georadiusRo :: FromResp a => ByteString -> Double -> Double -> Double -> GeoUnit -> [GeoRadiusFlag] -> RedisCommandClient client a #

georadiusByMember :: FromResp a => ByteString -> ByteString -> Double -> GeoUnit -> [GeoRadiusFlag] -> RedisCommandClient client a #

georadiusByMemberRo :: FromResp a => ByteString -> ByteString -> Double -> GeoUnit -> [GeoRadiusFlag] -> RedisCommandClient client a #

geosearch :: FromResp a => ByteString -> GeoSearchFrom -> GeoSearchBy -> [GeoSearchOption] -> RedisCommandClient client a #

geosearchstore :: FromResp a => ByteString -> ByteString -> GeoSearchFrom -> GeoSearchBy -> [GeoSearchOption] -> Bool -> RedisCommandClient client a #

clusterSlots :: FromResp a => RedisCommandClient client a #

data ClientState (client :: ConnectionStatus -> Type) #

Constructors

ClientState 

Instances

Instances details
Client client => MonadState (ClientState client) (RedisCommandClient client) 
Instance details

Defined in Database.Redis.Command

Methods

get :: RedisCommandClient client (ClientState client) #

put :: ClientState client -> RedisCommandClient client () #

state :: (ClientState client -> (a, ClientState client)) -> RedisCommandClient client a #

data RedisCommandClient (client :: ConnectionStatus -> Type) a where #

Constructors

RedisCommandClient 

Fields

Instances

Instances details
Client client => MonadIO (RedisCommandClient client) 
Instance details

Defined in Database.Redis.Command

Methods

liftIO :: IO a -> RedisCommandClient client a #

Client client => Applicative (RedisCommandClient client) 
Instance details

Defined in Database.Redis.Command

Methods

pure :: a -> RedisCommandClient client a #

(<*>) :: RedisCommandClient client (a -> b) -> RedisCommandClient client a -> RedisCommandClient client b #

liftA2 :: (a -> b -> c) -> RedisCommandClient client a -> RedisCommandClient client b -> RedisCommandClient client c #

(*>) :: RedisCommandClient client a -> RedisCommandClient client b -> RedisCommandClient client b #

(<*) :: RedisCommandClient client a -> RedisCommandClient client b -> RedisCommandClient client a #

Client client => Functor (RedisCommandClient client) 
Instance details

Defined in Database.Redis.Command

Methods

fmap :: (a -> b) -> RedisCommandClient client a -> RedisCommandClient client b #

(<$) :: a -> RedisCommandClient client b -> RedisCommandClient client a #

Client client => Monad (RedisCommandClient client) 
Instance details

Defined in Database.Redis.Command

Methods

(>>=) :: RedisCommandClient client a -> (a -> RedisCommandClient client b) -> RedisCommandClient client b #

(>>) :: RedisCommandClient client a -> RedisCommandClient client b -> RedisCommandClient client b #

return :: a -> RedisCommandClient client a #

Client client => MonadFail (RedisCommandClient client) 
Instance details

Defined in Database.Redis.Command

Methods

fail :: String -> RedisCommandClient client a #

Client client => RedisCommands (RedisCommandClient client) 
Instance details

Defined in Database.Redis.Command

Methods

auth :: FromResp a => ByteString -> ByteString -> RedisCommandClient client a #

ping :: FromResp a => RedisCommandClient client a #

set :: FromResp a => ByteString -> ByteString -> RedisCommandClient client a #

get :: FromResp a => ByteString -> RedisCommandClient client a #

mget :: FromResp a => [ByteString] -> RedisCommandClient client a #

setnx :: FromResp a => ByteString -> ByteString -> RedisCommandClient client a #

decr :: FromResp a => ByteString -> RedisCommandClient client a #

psetex :: FromResp a => ByteString -> Int -> ByteString -> RedisCommandClient client a #

bulkSet :: FromResp a => [(ByteString, ByteString)] -> RedisCommandClient client a #

flushAll :: FromResp a => RedisCommandClient client a #

dbsize :: FromResp a => RedisCommandClient client a #

del :: FromResp a => [ByteString] -> RedisCommandClient client a #

exists :: FromResp a => [ByteString] -> RedisCommandClient client a #

incr :: FromResp a => ByteString -> RedisCommandClient client a #

hset :: FromResp a => ByteString -> ByteString -> ByteString -> RedisCommandClient client a #

hget :: FromResp a => ByteString -> ByteString -> RedisCommandClient client a #

hmget :: FromResp a => ByteString -> [ByteString] -> RedisCommandClient client a #

hexists :: FromResp a => ByteString -> ByteString -> RedisCommandClient client a #

lpush :: FromResp a => ByteString -> [ByteString] -> RedisCommandClient client a #

lrange :: FromResp a => ByteString -> Int -> Int -> RedisCommandClient client a #

expire :: FromResp a => ByteString -> Int -> RedisCommandClient client a #

ttl :: FromResp a => ByteString -> RedisCommandClient client a #

rpush :: FromResp a => ByteString -> [ByteString] -> RedisCommandClient client a #

lpop :: FromResp a => ByteString -> RedisCommandClient client a #

rpop :: FromResp a => ByteString -> RedisCommandClient client a #

sadd :: FromResp a => ByteString -> [ByteString] -> RedisCommandClient client a #

smembers :: FromResp a => ByteString -> RedisCommandClient client a #

scard :: FromResp a => ByteString -> RedisCommandClient client a #

sismember :: FromResp a => ByteString -> ByteString -> RedisCommandClient client a #

hdel :: FromResp a => ByteString -> [ByteString] -> RedisCommandClient client a #

hkeys :: FromResp a => ByteString -> RedisCommandClient client a #

hvals :: FromResp a => ByteString -> RedisCommandClient client a #

llen :: FromResp a => ByteString -> RedisCommandClient client a #

lindex :: FromResp a => ByteString -> Int -> RedisCommandClient client a #

clientSetInfo :: FromResp a => [ByteString] -> RedisCommandClient client a #

clientReply :: ClientReplyValues -> RedisCommandClient client (Maybe RespData) #

zadd :: FromResp a => ByteString -> [(Int, ByteString)] -> RedisCommandClient client a #

zrange :: FromResp a => ByteString -> Int -> Int -> Bool -> RedisCommandClient client a #

geoadd :: FromResp a => ByteString -> [(Double, Double, ByteString)] -> RedisCommandClient client a #

geodist :: FromResp a => ByteString -> ByteString -> ByteString -> Maybe GeoUnit -> RedisCommandClient client a #

geohash :: FromResp a => ByteString -> [ByteString] -> RedisCommandClient client a #

geopos :: FromResp a => ByteString -> [ByteString] -> RedisCommandClient client a #

georadius :: FromResp a => ByteString -> Double -> Double -> Double -> GeoUnit -> [GeoRadiusFlag] -> RedisCommandClient client a #

georadiusRo :: FromResp a => ByteString -> Double -> Double -> Double -> GeoUnit -> [GeoRadiusFlag] -> RedisCommandClient client a #

georadiusByMember :: FromResp a => ByteString -> ByteString -> Double -> GeoUnit -> [GeoRadiusFlag] -> RedisCommandClient client a #

georadiusByMemberRo :: FromResp a => ByteString -> ByteString -> Double -> GeoUnit -> [GeoRadiusFlag] -> RedisCommandClient client a #

geosearch :: FromResp a => ByteString -> GeoSearchFrom -> GeoSearchBy -> [GeoSearchOption] -> RedisCommandClient client a #

geosearchstore :: FromResp a => ByteString -> ByteString -> GeoSearchFrom -> GeoSearchBy -> [GeoSearchOption] -> Bool -> RedisCommandClient client a #

clusterSlots :: FromResp a => RedisCommandClient client a #

Client client => MonadState (ClientState client) (RedisCommandClient client) 
Instance details

Defined in Database.Redis.Command

Methods

get :: RedisCommandClient client (ClientState client) #

put :: ClientState client -> RedisCommandClient client () #

state :: (ClientState client -> (a, ClientState client)) -> RedisCommandClient client a #

convertResp :: (FromResp a, MonadIO m) => RespData -> m a #

parseManyWith :: forall (client :: ConnectionStatus -> Type) m. (Client client, MonadIO m, MonadState (ClientState client) m) => Int -> m ByteString -> m [RespData] #

parseWith :: forall (client :: ConnectionStatus -> Type) m. (Client client, MonadIO m, MonadState (ClientState client) m) => m ByteString -> m RespData #

showBS :: Show a => a -> ByteString #

FromResp conversion

class FromResp a where #

Instances

Instances details
FromResp ByteString 
Instance details

Defined in Database.Redis.FromResp

FromResp RespData 
Instance details

Defined in Database.Redis.FromResp

FromResp Text 
Instance details

Defined in Database.Redis.FromResp

FromResp Integer 
Instance details

Defined in Database.Redis.FromResp

FromResp () 
Instance details

Defined in Database.Redis.FromResp

FromResp Bool 
Instance details

Defined in Database.Redis.FromResp

FromResp (Maybe ByteString) 
Instance details

Defined in Database.Redis.FromResp

FromResp (Maybe Text) 
Instance details

Defined in Database.Redis.FromResp

FromResp [ByteString] 
Instance details

Defined in Database.Redis.FromResp

FromResp [RespData] 
Instance details

Defined in Database.Redis.FromResp

Cluster

data ClusterNode #

Instances

Instances details
Show ClusterNode 
Instance details

Defined in Database.Redis.Cluster

Eq ClusterNode 
Instance details

Defined in Database.Redis.Cluster

data NodeRole #

Constructors

Master 
Replica 

Instances

Instances details
Show NodeRole 
Instance details

Defined in Database.Redis.Cluster

Eq NodeRole 
Instance details

Defined in Database.Redis.Cluster

data SlotRange #

Instances

Instances details
Show SlotRange 
Instance details

Defined in Database.Redis.Cluster

Eq SlotRange 
Instance details

Defined in Database.Redis.Cluster

data ClusterClient (client :: ConnectionStatus -> Type) #

Instances

Instances details
Client client => MonadState (ClusterClient client) (ClusterCommandClient client) 
Instance details

Defined in Database.Redis.Cluster.Client

Methods

get :: ClusterCommandClient client (ClusterClient client) #

put :: ClusterClient client -> ClusterCommandClient client () #

state :: (ClusterClient client -> (a, ClusterClient client)) -> ClusterCommandClient client a #

data ClusterCommandClient (client :: ConnectionStatus -> Type) a #

Instances

Instances details
Client client => MonadIO (ClusterCommandClient client) 
Instance details

Defined in Database.Redis.Cluster.Client

Methods

liftIO :: IO a -> ClusterCommandClient client a #

Client client => Applicative (ClusterCommandClient client) 
Instance details

Defined in Database.Redis.Cluster.Client

Methods

pure :: a -> ClusterCommandClient client a #

(<*>) :: ClusterCommandClient client (a -> b) -> ClusterCommandClient client a -> ClusterCommandClient client b #

liftA2 :: (a -> b -> c) -> ClusterCommandClient client a -> ClusterCommandClient client b -> ClusterCommandClient client c #

(*>) :: ClusterCommandClient client a -> ClusterCommandClient client b -> ClusterCommandClient client b #

(<*) :: ClusterCommandClient client a -> ClusterCommandClient client b -> ClusterCommandClient client a #

Client client => Functor (ClusterCommandClient client) 
Instance details

Defined in Database.Redis.Cluster.Client

Methods

fmap :: (a -> b) -> ClusterCommandClient client a -> ClusterCommandClient client b #

(<$) :: a -> ClusterCommandClient client b -> ClusterCommandClient client a #

Client client => Monad (ClusterCommandClient client) 
Instance details

Defined in Database.Redis.Cluster.Client

Methods

(>>=) :: ClusterCommandClient client a -> (a -> ClusterCommandClient client b) -> ClusterCommandClient client b #

(>>) :: ClusterCommandClient client a -> ClusterCommandClient client b -> ClusterCommandClient client b #

return :: a -> ClusterCommandClient client a #

Client client => MonadFail (ClusterCommandClient client) 
Instance details

Defined in Database.Redis.Cluster.Client

Methods

fail :: String -> ClusterCommandClient client a #

Client client => RedisCommands (ClusterCommandClient client) 
Instance details

Defined in Database.Redis.Cluster.Client

Methods

auth :: FromResp a => ByteString -> ByteString -> ClusterCommandClient client a #

ping :: FromResp a => ClusterCommandClient client a #

set :: FromResp a => ByteString -> ByteString -> ClusterCommandClient client a #

get :: FromResp a => ByteString -> ClusterCommandClient client a #

mget :: FromResp a => [ByteString] -> ClusterCommandClient client a #

setnx :: FromResp a => ByteString -> ByteString -> ClusterCommandClient client a #

decr :: FromResp a => ByteString -> ClusterCommandClient client a #

psetex :: FromResp a => ByteString -> Int -> ByteString -> ClusterCommandClient client a #

bulkSet :: FromResp a => [(ByteString, ByteString)] -> ClusterCommandClient client a #

flushAll :: FromResp a => ClusterCommandClient client a #

dbsize :: FromResp a => ClusterCommandClient client a #

del :: FromResp a => [ByteString] -> ClusterCommandClient client a #

exists :: FromResp a => [ByteString] -> ClusterCommandClient client a #

incr :: FromResp a => ByteString -> ClusterCommandClient client a #

hset :: FromResp a => ByteString -> ByteString -> ByteString -> ClusterCommandClient client a #

hget :: FromResp a => ByteString -> ByteString -> ClusterCommandClient client a #

hmget :: FromResp a => ByteString -> [ByteString] -> ClusterCommandClient client a #

hexists :: FromResp a => ByteString -> ByteString -> ClusterCommandClient client a #

lpush :: FromResp a => ByteString -> [ByteString] -> ClusterCommandClient client a #

lrange :: FromResp a => ByteString -> Int -> Int -> ClusterCommandClient client a #

expire :: FromResp a => ByteString -> Int -> ClusterCommandClient client a #

ttl :: FromResp a => ByteString -> ClusterCommandClient client a #

rpush :: FromResp a => ByteString -> [ByteString] -> ClusterCommandClient client a #

lpop :: FromResp a => ByteString -> ClusterCommandClient client a #

rpop :: FromResp a => ByteString -> ClusterCommandClient client a #

sadd :: FromResp a => ByteString -> [ByteString] -> ClusterCommandClient client a #

smembers :: FromResp a => ByteString -> ClusterCommandClient client a #

scard :: FromResp a => ByteString -> ClusterCommandClient client a #

sismember :: FromResp a => ByteString -> ByteString -> ClusterCommandClient client a #

hdel :: FromResp a => ByteString -> [ByteString] -> ClusterCommandClient client a #

hkeys :: FromResp a => ByteString -> ClusterCommandClient client a #

hvals :: FromResp a => ByteString -> ClusterCommandClient client a #

llen :: FromResp a => ByteString -> ClusterCommandClient client a #

lindex :: FromResp a => ByteString -> Int -> ClusterCommandClient client a #

clientSetInfo :: FromResp a => [ByteString] -> ClusterCommandClient client a #

clientReply :: ClientReplyValues -> ClusterCommandClient client (Maybe RespData) #

zadd :: FromResp a => ByteString -> [(Int, ByteString)] -> ClusterCommandClient client a #

zrange :: FromResp a => ByteString -> Int -> Int -> Bool -> ClusterCommandClient client a #

geoadd :: FromResp a => ByteString -> [(Double, Double, ByteString)] -> ClusterCommandClient client a #

geodist :: FromResp a => ByteString -> ByteString -> ByteString -> Maybe GeoUnit -> ClusterCommandClient client a #

geohash :: FromResp a => ByteString -> [ByteString] -> ClusterCommandClient client a #

geopos :: FromResp a => ByteString -> [ByteString] -> ClusterCommandClient client a #

georadius :: FromResp a => ByteString -> Double -> Double -> Double -> GeoUnit -> [GeoRadiusFlag] -> ClusterCommandClient client a #

georadiusRo :: FromResp a => ByteString -> Double -> Double -> Double -> GeoUnit -> [GeoRadiusFlag] -> ClusterCommandClient client a #

georadiusByMember :: FromResp a => ByteString -> ByteString -> Double -> GeoUnit -> [GeoRadiusFlag] -> ClusterCommandClient client a #

georadiusByMemberRo :: FromResp a => ByteString -> ByteString -> Double -> GeoUnit -> [GeoRadiusFlag] -> ClusterCommandClient client a #

geosearch :: FromResp a => ByteString -> GeoSearchFrom -> GeoSearchBy -> [GeoSearchOption] -> ClusterCommandClient client a #

geosearchstore :: FromResp a => ByteString -> ByteString -> GeoSearchFrom -> GeoSearchBy -> [GeoSearchOption] -> Bool -> ClusterCommandClient client a #

clusterSlots :: FromResp a => ClusterCommandClient client a #

Client client => MonadState (ClusterClient client) (ClusterCommandClient client) 
Instance details

Defined in Database.Redis.Cluster.Client

Methods

get :: ClusterCommandClient client (ClusterClient client) #

put :: ClusterClient client -> ClusterCommandClient client () #

state :: (ClusterClient client -> (a, ClusterClient client)) -> ClusterCommandClient client a #

closeClusterClient :: forall (client :: ConnectionStatus -> Type). Client client => ClusterClient client -> IO () #

refreshTopology :: forall (client :: ConnectionStatus -> Type). Client client => ClusterClient client -> IO () #

runClusterCommandClient :: forall (client :: ConnectionStatus -> Type) a. Client client => ClusterClient client -> ClusterCommandClient client a -> IO a #

data ConnectionPool (client :: ConnectionStatus -> Type) #

Constructors

ConnectionPool 

Fields

data PoolConfig #

Instances

Instances details
Show PoolConfig 
Instance details

Defined in Database.Redis.Cluster.ConnectionPool

closePool :: forall (client :: ConnectionStatus -> Type). Client client => ConnectionPool client -> IO () #

createPool :: forall (client :: ConnectionStatus -> Type). PoolConfig -> IO (ConnectionPool client) #

withConnection :: Client client => ConnectionPool client -> NodeAddress -> Connector client -> (client 'Connected -> IO a) -> IO a #

Multiplexing

data MultiplexPool (client :: ConnectionStatus -> Type) #

closeMultiplexPool :: forall (client :: ConnectionStatus -> Type). MultiplexPool client -> IO () #

createMultiplexPool :: Client client => Connector client -> Int -> IO (MultiplexPool client) #

submitToNode :: forall (client :: ConnectionStatus -> Type). Client client => MultiplexPool client -> NodeAddress -> Builder -> IO RespData #

Standalone Multiplexed Client

data StandaloneCommandClient a #

Instances

Instances details
MonadIO StandaloneCommandClient 
Instance details

Defined in Database.Redis.Standalone

Applicative StandaloneCommandClient 
Instance details

Defined in Database.Redis.Standalone

Functor StandaloneCommandClient 
Instance details

Defined in Database.Redis.Standalone

Monad StandaloneCommandClient 
Instance details

Defined in Database.Redis.Standalone

MonadFail StandaloneCommandClient 
Instance details

Defined in Database.Redis.Standalone

RedisCommands StandaloneCommandClient 
Instance details

Defined in Database.Redis.Standalone

Methods

auth :: FromResp a => ByteString -> ByteString -> StandaloneCommandClient a #

ping :: FromResp a => StandaloneCommandClient a #

set :: FromResp a => ByteString -> ByteString -> StandaloneCommandClient a #

get :: FromResp a => ByteString -> StandaloneCommandClient a #

mget :: FromResp a => [ByteString] -> StandaloneCommandClient a #

setnx :: FromResp a => ByteString -> ByteString -> StandaloneCommandClient a #

decr :: FromResp a => ByteString -> StandaloneCommandClient a #

psetex :: FromResp a => ByteString -> Int -> ByteString -> StandaloneCommandClient a #

bulkSet :: FromResp a => [(ByteString, ByteString)] -> StandaloneCommandClient a #

flushAll :: FromResp a => StandaloneCommandClient a #

dbsize :: FromResp a => StandaloneCommandClient a #

del :: FromResp a => [ByteString] -> StandaloneCommandClient a #

exists :: FromResp a => [ByteString] -> StandaloneCommandClient a #

incr :: FromResp a => ByteString -> StandaloneCommandClient a #

hset :: FromResp a => ByteString -> ByteString -> ByteString -> StandaloneCommandClient a #

hget :: FromResp a => ByteString -> ByteString -> StandaloneCommandClient a #

hmget :: FromResp a => ByteString -> [ByteString] -> StandaloneCommandClient a #

hexists :: FromResp a => ByteString -> ByteString -> StandaloneCommandClient a #

lpush :: FromResp a => ByteString -> [ByteString] -> StandaloneCommandClient a #

lrange :: FromResp a => ByteString -> Int -> Int -> StandaloneCommandClient a #

expire :: FromResp a => ByteString -> Int -> StandaloneCommandClient a #

ttl :: FromResp a => ByteString -> StandaloneCommandClient a #

rpush :: FromResp a => ByteString -> [ByteString] -> StandaloneCommandClient a #

lpop :: FromResp a => ByteString -> StandaloneCommandClient a #

rpop :: FromResp a => ByteString -> StandaloneCommandClient a #

sadd :: FromResp a => ByteString -> [ByteString] -> StandaloneCommandClient a #

smembers :: FromResp a => ByteString -> StandaloneCommandClient a #

scard :: FromResp a => ByteString -> StandaloneCommandClient a #

sismember :: FromResp a => ByteString -> ByteString -> StandaloneCommandClient a #

hdel :: FromResp a => ByteString -> [ByteString] -> StandaloneCommandClient a #

hkeys :: FromResp a => ByteString -> StandaloneCommandClient a #

hvals :: FromResp a => ByteString -> StandaloneCommandClient a #

llen :: FromResp a => ByteString -> StandaloneCommandClient a #

lindex :: FromResp a => ByteString -> Int -> StandaloneCommandClient a #

clientSetInfo :: FromResp a => [ByteString] -> StandaloneCommandClient a #

clientReply :: ClientReplyValues -> StandaloneCommandClient (Maybe RespData) #

zadd :: FromResp a => ByteString -> [(Int, ByteString)] -> StandaloneCommandClient a #

zrange :: FromResp a => ByteString -> Int -> Int -> Bool -> StandaloneCommandClient a #

geoadd :: FromResp a => ByteString -> [(Double, Double, ByteString)] -> StandaloneCommandClient a #

geodist :: FromResp a => ByteString -> ByteString -> ByteString -> Maybe GeoUnit -> StandaloneCommandClient a #

geohash :: FromResp a => ByteString -> [ByteString] -> StandaloneCommandClient a #

geopos :: FromResp a => ByteString -> [ByteString] -> StandaloneCommandClient a #

georadius :: FromResp a => ByteString -> Double -> Double -> Double -> GeoUnit -> [GeoRadiusFlag] -> StandaloneCommandClient a #

georadiusRo :: FromResp a => ByteString -> Double -> Double -> Double -> GeoUnit -> [GeoRadiusFlag] -> StandaloneCommandClient a #

georadiusByMember :: FromResp a => ByteString -> ByteString -> Double -> GeoUnit -> [GeoRadiusFlag] -> StandaloneCommandClient a #

georadiusByMemberRo :: FromResp a => ByteString -> ByteString -> Double -> GeoUnit -> [GeoRadiusFlag] -> StandaloneCommandClient a #

geosearch :: FromResp a => ByteString -> GeoSearchFrom -> GeoSearchBy -> [GeoSearchOption] -> StandaloneCommandClient a #

geosearchstore :: FromResp a => ByteString -> ByteString -> GeoSearchFrom -> GeoSearchBy -> [GeoSearchOption] -> Bool -> StandaloneCommandClient a #

clusterSlots :: FromResp a => StandaloneCommandClient a #

Connection Helpers

type Connector (client :: ConnectionStatus -> Type) = NodeAddress -> IO (client 'Connected) #

ByteString (re-exported for convenience)

data ByteString #

A space-efficient representation of a Word8 vector, supporting many efficient operations.

A ByteString contains 8-bit bytes, or by using the operations from Data.ByteString.Char8 it can be interpreted as containing 8-bit characters.

Instances

Instances details
NFData ByteString 
Instance details

Defined in Data.ByteString.Internal.Type

Methods

rnf :: ByteString -> () #

Monoid ByteString 
Instance details

Defined in Data.ByteString.Internal.Type

Semigroup ByteString 
Instance details

Defined in Data.ByteString.Internal.Type

Data ByteString 
Instance details

Defined in Data.ByteString.Internal.Type

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ByteString -> c ByteString #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ByteString #

toConstr :: ByteString -> Constr #

dataTypeOf :: ByteString -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ByteString) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ByteString) #

gmapT :: (forall b. Data b => b -> b) -> ByteString -> ByteString #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ByteString -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ByteString -> r #

gmapQ :: (forall d. Data d => d -> u) -> ByteString -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ByteString -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString #

IsString ByteString

Beware: fromString truncates multi-byte characters to octets. e.g. "枯朶に烏のとまりけり秋の暮" becomes �6k�nh~�Q��n�

Instance details

Defined in Data.ByteString.Internal.Type

IsList ByteString

Since: bytestring-0.10.12.0

Instance details

Defined in Data.ByteString.Internal.Type

Associated Types

type Item ByteString 
Instance details

Defined in Data.ByteString.Internal.Type

Read ByteString 
Instance details

Defined in Data.ByteString.Internal.Type

Show ByteString 
Instance details

Defined in Data.ByteString.Internal.Type

Eq ByteString 
Instance details

Defined in Data.ByteString.Internal.Type

Ord ByteString 
Instance details

Defined in Data.ByteString.Internal.Type

FromResp ByteString 
Instance details

Defined in Database.Redis.FromResp

Lift ByteString

Since: bytestring-0.11.2.0

Instance details

Defined in Data.ByteString.Internal.Type

Methods

lift :: Quote m => ByteString -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => ByteString -> Code m ByteString #

a ~ ByteString => IsString (Parser a) 
Instance details

Defined in Data.Attoparsec.ByteString.Char8

Methods

fromString :: String -> Parser a #

FromResp (Maybe ByteString) 
Instance details

Defined in Database.Redis.FromResp

FromResp [ByteString] 
Instance details

Defined in Database.Redis.FromResp

type Item ByteString 
Instance details

Defined in Data.ByteString.Internal.Type