memcache-0.3.0.2: A memcached client library.
Copyright(c) David Terei 2016
LicenseBSD
Maintainercode@davidterei.com
Stabilitystable
PortabilityGHC
Safe HaskellSafe-Inferred
LanguageHaskell2010

Database.Memcache.Cluster

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

Cluster

data Cluster Source #

Memcached cluster.

data ServerSpec Source #

ServerSpec specifies a server configuration for connection.

Constructors

ServerSpec 

Fields

Instances

Instances details
Show ServerSpec Source # 
Instance details

Defined in Database.Memcache.Cluster

Default ServerSpec Source # 
Instance details

Defined in Database.Memcache.Cluster

Methods

def :: ServerSpec #

Eq ServerSpec Source # 
Instance details

Defined in Database.Memcache.Cluster

data Options Source #

Options specifies how a Memcached cluster should be configured.

Constructors

Options 

Fields

  • optsServerRetries :: Retries

    Number of times to retry an operation on failure. If consecutive failures exceed this value for a server, we mark it as down and failover to a different server for the next operation.

    Default is 2.

  • optsFailRetryDelay :: Milli

    After an operation has failed, how long to wait before retrying it while still within the optsServerRetries count?

    Default is 200ms.

  • optsDeadRetryDelay :: Milli

    How long to wait after a server has been marked down, before trying to use it again.

    Default is 1500ms.

  • optsServerTimeout :: Milli

    How long to wait for an operation to complete before considering it failed.

    Default is 750ms.

  • optsGetServerForKey :: Cluster -> Key -> IO (Maybe Server)

    Figure out which server to talk to for a given key.

    Default is getServerForKeyDefault.

Instances

Instances details
Default Options Source # 
Instance details

Defined in Database.Memcache.Cluster

Methods

def :: Options #

newCluster :: [ServerSpec] -> Options -> IO Cluster Source #

Establish a new connection to a group of Memcached servers.

Operations

type Retries = Int Source #

Number of times to retry an operation before considering it failed.

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.

allOp' :: Cluster -> (Server -> IO a) -> IO [(Server, a)] Source #

Run a Memcached operation against all servers in the cluster, handling any failures that occur, retrying the specified number of times. Similar to anyOp but allows more flexible interaction with the Server than a single request and response.