A threadsafe pool of network connections to a Redis server. Use the connect function to create one.
Modulehedis-0.16.4Haskell2010
Database.Redis.Connection
- 5 types
- 13 values
- Packagehedis-0.16.4
- Exports18
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceConnection.hs
Information for connnecting to a Redis server.
It is recommended to not use the ConnInfo data constructor directly. Instead use defaultConnectInfo and update it with record syntax. For example to connect to a password protected Redis server running on localhost and listening to the default port:
myConnectInfo :: ConnectInfo
myConnectInfo = defaultConnectInfo {connectAuth = Just "secret"}
Or better yet, use parseConnectInfo to parse a URL.
Constructors
ConnInfoconnectAddr :: !ConnectAddrconnectAuth :: !Maybe ByteStringWhen the server is protected by a password, set connectAuth to Just the password. Each connection will then authenticate by the
authcommand.connectUsername :: !Maybe ByteStringWhen ACL is used set connectUsername as the user.
connectDatabase :: !IntegerEach connection will select the database with the given index.
connectMaxConnections :: !IntMaximum number of connections to keep open. The smallest acceptable value is 1.
connectNumStripes :: !Maybe IntNumber of stripes in the connection pool.
connectMaxIdleTime :: !NominalDiffTimeAmount of time for which an unused connection is kept open. The smallest acceptable value is 0.5 seconds. If the
timeoutvalue in your redis.conf file is non-zero, it should be larger than connectMaxIdleTime.connectTimeout :: !Maybe NominalDiffTimeOptional timeout until connection to Redis gets established.
ConnectTimeoutExceptiongets thrown if no socket get connected in this interval of time.connectTLSParams :: !Maybe ClientParamsOptional TLS parameters. TLS will be enabled if this is provided.
connectHooks :: !HooksConnection hooks. See Database.Redis.Hooks for usage and examples.
connectPoolLabel :: !TextLabel of the connection pool for instrumentation.
Instances1Show
Show ConnectInfoDefined in hedis-0.16.4 · Database.Redis.Connection
Constructors
Instances3Eq, Show, Exception
Eq ConnectErrorDefined in hedis-0.16.4 · Database.Redis.ConnectionShow ConnectErrorDefined in hedis-0.16.4 · Database.Redis.ConnectionException ConnectErrorDefined in hedis-0.16.4 · Database.Redis.Connection
Default information for connecting:
connectAddr = ConnectAddrHostPort "localhost" 6379 -- Redis default port
connectAuth = Nothing -- No password
connectUsername = Nothing -- No user
connectDatabase = 0 -- SELECT database 0
connectMaxConnections = 50 -- Up to 50 connections
connectNumStripes = Just 1 -- A single stripe
connectMaxIdleTime = 30 -- Keep open for 30 seconds
connectTimeout = Nothing -- Don't add timeout logic
connectTLSParams = Nothing -- Do not use TLS
connectHooks = defaultHooks -- Do nothing
connectPoolLabel = "" -- no label
Constructs a Connection pool to a Redis server designated by the given ConnectInfo.
The function always succeeds, because the first connection is not actually established until the first call to the server.
Constructs a Connection pool to a Redis server designated by the given ConnectInfo, then tests if the server is actually there.
Throws an ConnectError exception if the connection to the Redis server can't be established.
Constructs a Connection pool to a Redis cluster designated by the given ConnectInfo, then tests if the server is actually there.
Throws an ClusterConnectError exception if the connection to the Redis server can't be established.
Constructors
Instances3Eq, Show, Exception
Eq ClusterDownErrorDefined in hedis-0.16.4 · Database.Redis.ConnectionShow ClusterDownErrorDefined in hedis-0.16.4 · Database.Redis.ConnectionException ClusterDownErrorDefined in hedis-0.16.4 · Database.Redis.Connection
Destroy all idle resources in the pool, works for all types of the connection.
Memory bracket around connect and disconnect.
Memory bracket around checkedConnect and disconnect
Interact with a Redis datastore specified by the given Connection.
Each call of runRedis takes a network connection from the Connection pool and runs the given Redis action. Calls to runRedis may thus block while all connections from the pool are in use.
Interact with a Redis datastore specified by the given Connection, but return early if acquiring from the connection pool would block.
Like runRedis, but if all connections in the Connection pool are used, it immediately returns Nothing. This can be useful for logging purposes.
Constructors
Instances3Eq, Show, Exception
Eq ClusterConnectErrorDefined in hedis-0.16.4 · Database.Redis.ConnectionShow ClusterConnectErrorDefined in hedis-0.16.4 · Database.Redis.ConnectionException ClusterConnectErrorDefined in hedis-0.16.4 · Database.Redis.Connection
Constructs a ShardMap of connections to clustered nodes. The argument is a ConnectInfo for any node in the cluster
Some Redis commands are currently not supported in cluster mode - CONFIG, AUTH - SCAN - MOVE, SELECT - RESET