Memcache.Connection.start_link
start_link
, go back to Memcache.Connection module for more information.
Specs
start_link(Keyword.t(), Keyword.t()) :: GenServer.on_start()
Starts a connection to memcached server.
The actual TCP connection to the memcached server is established
asynchronously after the start_link/2
returns.
This function accepts two option lists. The first one specifies the
options to connect to the memcached server. The second option is
passed directly to the underlying GenServer.start_link/3
, so it
can be used to create named process.
Memcachex automatically tries to reconnect in case of tcp connection
failures. It starts with a :backoff_initial
wait time and
increases the wait time exponentially on each successive failures
until it reaches the :backoff_max
. After that, it waits for
:backoff_max
after each failure.
Connection Options
:hostname
- (string) hostname of the memcached server. Defaults to"localhost"
:port
- (integer) port on which the memcached server is listening. Defaults to11211
:backoff_initial
- (integer) initial backoff (in milliseconds) to be used in case of connection failure. Defaults to500
:backoff_max
- (integer) maximum allowed interval between two connection attempt. Defaults to30_000
:connect_timeout
- (integer) connection timeout (in milliseconds) at which to terminate the connection attempt in case of an unresponsive host. Defaults to :infinity:auth
- (tuple) only plain authentication method is supported. It is specified using the following format{:plain, "username", "password"}
. Defaults tonil
.
Examples
{:ok, pid} = Memcache.Connection.start_link()