Support » Plugin: WP-FFPC » multiple memcached servers

  • Resolved ivan.buttinoni

    (@ivanbuttinoni)


    I’d like to use 2 or more memcached server, but seem that your plugin don’t support this.

    I use the php-pecl-memcached extension and the 0.4.1 version of your plugin.

    I patch “wp-content/plugins/wp-ffpc/wp-ffpc-common.php” al line 76

    From:

    $wp_ffpc_backend->addServer( $wp_ffpc_config['host'], $wp_ffpc_config['port'] );

    To:

    $_list = explode(',',$wp_ffpc_config['host']);
      foreach($_list as $_server){
        $wp_ffpc_backend->addServer( $_server , $wp_ffpc_config['port'] );
      }

    May be you prefer a different approach.

    Waiting for your feedback.
    Ivan

    http://wordpress.org/extend/plugins/wp-ffpc/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Only later I catch the $wp_ffpc_backend_status.
    I change the code to set the return value, in a optimistic way, it’s true if any server works.

    I snippet the whole case code:

    /* in case of Memcached */
    		case 'memcached':
    			/* Memcached class does not exist, Memcached extension is not available */
    			if (!class_exists('Memcached'))
    				return false;
    
                $wp_ffpc_backend_status = false;
                $_list = explode(',',$wp_ffpc_config['host']);
    
                if ( $wp_ffpc_backend == NULL )
    			{
    				$wp_ffpc_backend = new Memcached();
    				$wp_ffpc_backend->setOption( Memcached::OPT_COMPRESSION , false );
    				$wp_ffpc_backend->setOption( Memcached::OPT_BINARY_PROTOCOL , true );
    
    				foreach($_list as $_server){
    					$wp_ffpc_backend->addServer( $_server , $wp_ffpc_config['port'] );
    				}
    
                }
                foreach($_list as $_server){
                    $wp_ffpc_backend_status = $wp_ffpc_backend_status ||  array_key_exists( $_server . ':' . $wp_ffpc_config['port'] , $wp_ffpc_backend->getStats() );
                }
    
                break;
    Plugin Author petermolnar

    (@cadeyrn)

    Hi ivan,

    I’m putting multiple memcached server support to next version 0.5. It’s about to be released within a few days, although the end solution is a bit different from you suggestion.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘multiple memcached servers’ is closed to new replies.