MEMCACHE.CLOSE(3) 1 MEMCACHE.CLOSE(3)Memcache::close - Close memcached server connection
SYNOPSIS
bool Memcache::close (void )
DESCRIPTION Memcache.close(3) closes connection to memcached server. This function doesn't close persistent connections, which are closed only during
web-server shutdown/restart. Also you can use memcache_close(3) function.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
Memcache.close(3) example
<?php
/* procedural API */
$memcache_obj = memcache_connect('memcache_host', 11211);
/*
do something here ..
*/
memcache_close($memcache_obj);
/* OO API */
$memcache_obj = new Memcache;
$memcache_obj->connect('memcache_host', 11211);
/*
do something here ..
*/
$memcache_obj->close();
?>
SEE ALSO Memcache.connect(3), Memcache.pconnect(3).
PHP Documentation Group MEMCACHE.CLOSE(3)
Check Out this Related Man Page
MEMCACHE.SETSERVERPARAMS(3) 1 MEMCACHE.SETSERVERPARAMS(3)Memcache::setServerParams - Changes server parameters and status at runtime
SYNOPSIS
bool Memcache::setServerParams (string $host, [int $port = 11211], [int $timeout], [int $retry_interval = false], [bool $status],
[callable $failure_callback])
DESCRIPTION Memcache.setServerParams(3) changes server parameters at runtime. You can also use the memcache_set_server_params(3) function.
Note
This function has been added to Memcache version 2.1.0.
PARAMETERS
o $host
- Point to the host where memcached is listening for connections.
o $port
- Point to the port where memcached is listening for connections.
o $timeout
- Value in seconds which will be used for connecting to the daemon. Think twice before changing the default value of 1 second -
you can lose all the advantages of caching if your connection is too slow.
o $retry_interval
- Controls how often a failed server will be retried, the default value is 15 seconds. Setting this parameter to -1 disables auto-
matic retry. Neither this nor the $persistent parameter has any effect when the extension is loaded dynamically via dl(3).
o $status
- Controls if the server should be flagged as online. Setting this parameter to FALSE and $retry_interval to -1 allows a failed
server to be kept in the pool so as not to affect the key distribution algorithm. Requests for this server will then failover or
fail immediately depending on the $memcache.allow_failover setting. Default to TRUE, meaning the server should be considered
online.
o $failure_callback
- Allows the user to specify a callback function to run upon encountering an error. The callback is run before failover is
attempted. The function takes two parameters, the hostname and port of the failed server.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
Memcache.setServerParams(3) example
<?php
function _callback_memcache_failure($host, $port) {
print "memcache '$host:$port' failed";
}
/* OO API */
$memcache = new Memcache;
// Add the server in offline mode
$memcache->addServer('memcache_host', 11211, false, 1, 1, -1, false);
// Bring the server back online
$memcache->setServerParams('memcache_host', 11211, 1, 15, true, '_callback_memcache_failure');
/* procedural API */
$memcache_obj = memcache_connect('memcache_host', 11211);
memcache_set_server_params($memcache_obj, 'memcache_host', 11211, 1, 15, true, '_callback_memcache_failure');
?>
SEE ALSO Memcache.addServer(3), Memcache.getServerStatus(3).
PHP Documentation Group MEMCACHE.SETSERVERPARAMS(3)