- Inheritance
- < Object
This class represents a memcached server instance.
Constants
Name | Description | |
---|---|---|
CONNECT_TIMEOUT | = 0.25 | The amount of time to wait to establish a connection with a memcached server. If a connection cannot be established within this time limit, the server will be marked as down. |
RETRY_DELAY | = 30.0 | The amount of time to wait before attempting to re-establish a connection with a server that is marked dead. |
Attributes
Name | Visibility | R/W | Description |
---|---|---|---|
host | public | R | The host the memcached server is running on. |
logger | public | R | |
port | public | R | The port the memcached server is listening on. |
retry | public | R | The time of next retry if the connection is dead. |
status | public | R | A text status string describing the state of the server. |
weight | public | R | The weight given to the server. |
Methods
Class
Visibility | Signature |
---|---|
public | new (memcache, host, port = DEFAULT_PORT, weight = DEFAULT_WEIGHT) |
Instance
Visibility | Signature |
---|---|
public | alive? () |
public | close () |
public | inspect () |
public | mark_dead (error) |
public | socket () |
Class Method Detail
new(memcache, host, port = DEFAULT_PORT, weight = DEFAULT_WEIGHT)
Create a new MemCache::Server object for the memcached instance listening on the given host and port, weighted by the given weight.
Instance Method Detail
alive?()
Check whether the server connection is alive. This will cause the socket to attempt to connect if it isn‘t already connected and or if the server was previously marked as down and the retry time has been exceeded.
close()
Close the connection to the memcached server targeted by this object. The server is not considered dead.
inspect()
Return a string representation of the server object.
mark_dead(error)
socket()
Try to connect to the memcached server targeted by this object. Returns the connected socket object on success or nil on failure.