multiple memcached upstream added to nginx sample git-svn-id: http://plugins.svn.wordpress.org/wp-ffpc/trunk@676902 b8457f37-d9ea-0310-8a92-e5e31aec5664
cadeyrn cadeyrn@b8457f37-d9ea-0310-8a92-e5e31aec5664
Wed, 06 Mar 2013 14:13:26 +0000
3 files changed,
21 insertions(+),
8 deletions(-)
M
nginx-sample.conf
→
nginx-sample.conf
@@ -1,5 +1,9 @@
http { ... + upstream memcached-servers { +MEMCACHED_SERVERS + } + ... server { ...@@ -24,7 +28,7 @@ set $memcached_request 0;
} if ( $memcached_request = 1) { - memcached_pass MEMCACHEDHOST:MEMCACHEDPORT; + memcached_pass memcached-servers; error_page 404 = @rewrites; }
M
readme.txt
→
readme.txt
@@ -16,6 +16,7 @@ PHP has two extension for communication with a memcached server, named Memcache and Memcached. The plugin can utilize both, however, the recommended is memcached.
= Features: = * exclude possibility of home, feeds, archieves, pages, singles +* possibility to enable caching for logged-in users * use APC or memcached as backend * 404 caching * redirects caching@@ -23,20 +24,21 @@ * Last Modified HTTP header compatibility with 304 responses
* shortlink HTTP header preservation * pingback HTTP header preservation(1) * fallback to no caching if any error or problem occurs +* syslog & debug settings available +* supports multiple memcached backends * Wordpress Network compatible(2) * nginx compatible(3) -* (optional) syslog messages of sets-gets-flushes (1) pingback hostname will always be generated from the accessed domain, otherwise speed would get highly compromised -(2) If used in WordPress Network, the configuration will only be available for network admins at the network admin panel, and will be system-wide and will be applied for every blog. +(2) If enabled as network-wide plugin in a WordPress Network, the configuration will only be available for network admins at the network admin panel, will be system-wide and will be applied for every blog. (3) nginx compatility means that if used with PHP Memcache or PHP Memcached extension, the created memcached entries can be read and served directly from nginx, making the cache insanely fast. -If used with APC, this feature is not available (no APC module for nginx), although, naturally, the cache modul is functional and working, but it will be done by PHP instead of nginx. -Short nginx example configuration is generated on the plugin settings page if Memcache or Memcached is selected as cache type. +If used with APC, this feature is not available (no APC module for nginx). +Short nginx example configuration is generated on the plugin settings page, under `nginx` tab. NOTE: some features ( most of additional HTTP headers for example ) will not be available with this solution! ( yet ) -Some parts were based on [Hyper Cache](http://wordpress.org/extend/plugins/hyper-cache "Hyper Cache") plugin by Satollo (info@satollo.net). +Parts are based on [Hyper Cache](http://wordpress.org/extend/plugins/hyper-cache "Hyper Cache") plugin by Satollo (info@satollo.net). == Installation == 1. Upload contents of `wp-ffpc.zip` to the `/wp-content/plugins/` directory@@ -50,9 +52,10 @@
= How to install memcache PHP extension? = On most of the distributions, php5-memcached or php5-mecache is available as package. You can use PECL alternatively: `pecl install memcached`. +It's recommended to use memcached. = How to use the plugin on Amazon Linux? = -You have to remove the default yum package, named `php-pecl-memcache` and install `Memcache` with PECL. +You have to remove the default yum package, named `php-pecl-memcache` and install `Memcache` or `Memcached` through PECL. == Changelog ==@@ -65,7 +68,7 @@ * long-running %3C really fixed ( version 0.4.3 was dead end ) by the help of Mark Costlow <cheeks@swcp.com>
* UI cleanup, introducing tabbed interface * WP-FFPC options moved from global menu to under Settings in both Site and Network Admin interfaces * added 'persistent' checkbox for memcached connections -* added possibility to add multiple memcached servers +* added support for multiple memcached servers, feature request from ivan.buttinoni ( ivanbuttinoni @ WordPress.org forum ) * case-sensitive string checks replaced with case-insensitives, contribution of Mark Costlow <cheeks@swcp.com> * refactored settings saving mechanism * additional syslog informations
M
wp-ffpc.php
→
wp-ffpc.php
@@ -465,6 +465,12 @@ $replace = array ( $this->options['prefix_data'], $this->options['host'], $this->options['port'] );
$nginx = file_get_contents ( WP_FFPC_DIR .'/nginx-sample.conf' ); $nginx = str_replace ( $search , $replace , $nginx ); + foreach ( array_keys( $this->options['servers'] ) as $server ) { + $nginx_servers .= " server ". $server .";\n"; + } + + $nginx = str_replace ( 'MEMCACHED_SERVERS' , $nginx_servers , $nginx ); + ?> <pre><?php echo $nginx; ?></pre> </fieldset>