diff --git a/reference/memcache/functions/memcache-addserver.xml b/reference/memcache/functions/memcache-addserver.xml new file mode 100644 index 0000000000..b328667eb9 --- /dev/null +++ b/reference/memcache/functions/memcache-addserver.xml @@ -0,0 +1,102 @@ + + + + + Memcache::addServer + Add a memcached server to connection pool + + + Description + + boolMemcache::addServer + stringhost + intport + boolpersistent + intweight + inttimeout + intretry_interval + + + Memcache::addServer adds a server to the connection + pool. The actual connection is established on first use. + Parameters host and port point + to the host and port, where memcached is listening for connections. + Parameter port is optional, it's default value is + 11211. + Parameter persistent controls the use of a persistent + connection, the default is &true;. + Parameter weight is the number of buckets to create for this + server which in turn control its probability of it being selected. The probability is + relative to the total weight of all servers. + You can define a timeout (in seconds), which will be + used when connecting to the daemon. Think twice before changing the default + value of 1 second - you can loose all the advantages of caching if your connection + is too slow. + Parameter retry_interval controls how often a failed server + will be retried, the default value is 15 seconds. Neither this nor the + persistent parameter has any effect when this extension + is loaded dynamically via dl. + + + The connection, which was opened using + Memcache::addServer will be automatically closed at the + end of script execution. Also you can close it with + Memcache::close. + + + You can also use the memcache_add_server function. + See example below. + + + <function>Memcache::addServer</function> example + +addServer('memcache_host', 11211); +$memcache->addServer('memcache_host2', 11211); + +/* procedural API */ + +$memcache_obj = memcache_connect('memcache_host', 11211); +memcache_add_server($memcache_obj, 'memcache_host2', 11211); + +?> +]]> + + + + &return.success; + + + See also + Memcache::connect, + Memcache::pconnect and + Memcache::close and + + + + + diff --git a/reference/memcache/functions/memcache-getextendedstats.xml b/reference/memcache/functions/memcache-getextendedstats.xml new file mode 100644 index 0000000000..0da36f3185 --- /dev/null +++ b/reference/memcache/functions/memcache-getextendedstats.xml @@ -0,0 +1,106 @@ + + + + + Memcache::getExtendedStats + Get statistics from all servers in pool + + + Description + + arrayMemcache::getExtendedStats + + + + Memcache::getExtendedStats returns an two-dimensional + associative array with server statistics. Array keys correspond to + host:port of server and values contain the individual server statistics. + A failed server will have its corresponding entry set to &false;. + + + + + +addServer('memcache_host', 11211); + $memcache_obj->addServer('failed_host', 11211); + + $stats = $memcache_obj->getExtendedStats(); + print_r($stats); +?> + +]]> + + &example.outputs; + + +Array +( + [memcache_host:11211] => Array + ( + [pid] => 3756 + [uptime] => 603011 + [time] => 1133810435 + [version] => 1.1.12 + [rusage_user] => 0.451931 + [rusage_system] => 0.634903 + [curr_items] => 2483 + [total_items] => 3079 + [bytes] => 2718136 + [curr_connections] => 2 + [total_connections] => 807 + [connection_structures] => 13 + [cmd_get] => 9748 + [cmd_set] => 3096 + [get_hits] => 5976 + [get_misses] => 3772 + [bytes_read] => 3448968 + [bytes_written] => 2318883 + [limit_maxbytes] => 33554432 + ) + + [failed_host:11211] => false +) + +]]> + + + + + You can also use the memcache_get_extended_stats function. + + + Memcache::getExtendedStats returns &false; in case of an + error. + + + See also + Memcache::getVersion. + Memcache::getStats. + + + + + diff --git a/reference/memcache/functions/memcache-getstats.xml b/reference/memcache/functions/memcache-getstats.xml index d2916450e0..e3d98b68e5 100644 --- a/reference/memcache/functions/memcache-getstats.xml +++ b/reference/memcache/functions/memcache-getstats.xml @@ -1,5 +1,5 @@ - + Memcache::getStats @@ -26,6 +26,7 @@ See also Memcache::getVersion. + Memcache::getExtendedStats. diff --git a/reference/memcache/functions/memcache-setcompressthreshold.xml b/reference/memcache/functions/memcache-setcompressthreshold.xml new file mode 100644 index 0000000000..c0826713d8 --- /dev/null +++ b/reference/memcache/functions/memcache-setcompressthreshold.xml @@ -0,0 +1,74 @@ + + + + + Memcache::setCompressThreshold + Enable automatic compression of large values + + + Description + + boolMemcache::setCompressThreshold + intthreshold + floatmin_savings + + + Memcache::setCompressThreshold enables automatic + compression of large values. Parameter threshold + controls the minimum value length before attempting to compress automatically. + Parameter min_savings specifies the minimum amount + of savings to actually store the value compressed. The supplied value + must be between 0 and 1. Default value is 0.2 giving a minimum 20% + compression savings. + + + You can also use the memcache_set_compress_threshold function. + See example below. + + + <function>Memcache::setCompressThreshold</function> example + +addServer('memcache_host', 11211); +$memcache_obj->setCompressThreshold(20000, 0.2); + +/* procedural API */ + +$memcache_obj = memcache_connect('memcache_host', 11211); +memcache_set_compress_threshold($memcache_obj, 20000, 0.2); + +?> +]]> + + + + &return.success; + + + + + diff --git a/reference/memcache/reference.xml b/reference/memcache/reference.xml index ef1c9b1f8c..c4a3ccbdbd 100644 --- a/reference/memcache/reference.xml +++ b/reference/memcache/reference.xml @@ -1,5 +1,5 @@ - + @@ -15,11 +15,6 @@ to memcached, highly effective caching daemon, which was especially designed to decrease database load in dynamic web applications. - - This module doesn't have native support of multiple servers, but you - still can implement it yourself in your application. Establish several - memcached connections, set priority level for each server etc. - More information about memcached can be found at &url.memcache;.