Copyright | (c) David Terei 2016 |
---|---|
License | BSD |
Maintainer | code@davidterei.com |
Stability | stable |
Portability | GHC |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Database.Memcache.Cluster
Contents
Description
Handles a group of connections to different Memcached servers.
We use consistent hashing to choose which server to route a request to. On an error, we mark the server as failed and remove it temporarialy from the set of servers available.
Synopsis
- data Cluster
- data ServerSpec = ServerSpec {}
- data Options = Options {}
- newCluster :: [ServerSpec] -> Options -> IO Cluster
- type Retries = Int
- keyedOp :: Cluster -> Key -> Request -> IO Response
- anyOp :: Cluster -> Request -> IO Response
- allOp :: Cluster -> Request -> IO [(Server, Response)]
- allOp' :: Cluster -> (Server -> IO a) -> IO [(Server, a)]
Cluster
data ServerSpec Source #
ServerSpec specifies a server configuration for connection.
Constructors
ServerSpec | |
Fields
|
Instances
Show ServerSpec Source # | |
Defined in Database.Memcache.Cluster Methods showsPrec :: Int -> ServerSpec -> ShowS # show :: ServerSpec -> String # showList :: [ServerSpec] -> ShowS # | |
Default ServerSpec Source # | |
Defined in Database.Memcache.Cluster Methods def :: ServerSpec # | |
Eq ServerSpec Source # | |
Defined in Database.Memcache.Cluster |
Options specifies how a Memcached cluster should be configured.
Constructors
Options | |
Fields
|
newCluster :: [ServerSpec] -> Options -> IO Cluster Source #
Establish a new connection to a group of Memcached servers.
Operations
keyedOp :: Cluster -> Key -> Request -> IO Response Source #
Run a Memcached operation against a particular server, handling any failures that occur, retrying the specified number of times.
anyOp :: Cluster -> Request -> IO Response Source #
Run a Memcached operation against any single server in the cluster, handling any failures that occur, retrying the specified number of times.
allOp :: Cluster -> Request -> IO [(Server, Response)] Source #
Run a Memcached operation against all servers in the cluster, handling any failures that occur, retrying the specified number of times.