tollmanz / wordpress-pecl-memcached-object-cache

A WordPress object cache that uses the memcached (not memcache) PECL extension.
233 stars 114 forks source link

memcached auth #32

Open szepeviktor opened 10 years ago

szepeviktor commented 10 years ago

Please consider supporting http://redislabs.com/memcached-cloud Redis Labs needs SASL auth for memcached.

Thank you!!

tollmanz commented 10 years ago

Thanks for the suggestion! Can you give me more information about what would be needed to support the service? Does it make sense to shoehorn this support into this library, or would it make more sense to build a separate library?

szepeviktor commented 10 years ago
szepeviktor commented 10 years ago

I think it is a oneliner: http://php.net/manual/en/memcached.setsaslauthdata.php

szepeviktor commented 10 years ago

And the missing doc: http://php.net/manual/en/book.memcached.php#110988 Actually it is a 3-liner

tollmanz commented 10 years ago

In response to your comment on #33, I think we'd need to update the $memcached_servers global variable in the wp-config.php file. Then in WP_Object_Cache::__construct(), we need to read in the auth variables and connect to the remote Memcached instance.

szepeviktor commented 10 years ago

Yes

define('MEMCACHE_SERVERS', serialize(array(
    array(
        '127.0.0.1',
        11211,
        'username',
        'passw0'
    ),
    array(
        'domain.com',
        11211,
        'username',
        'passw0'
    )
)));
$memcache_servers = unserialize(MEMCACHE_SERVERS);
// in a loop
if (isset($memcache_servers[$i][3])) {
    // need to auth
}
tollmanz commented 10 years ago

@szepeviktor If you would like to work on a pull request for this feature, I would be happy to consider it. I am not particularly motivated to add SASL support at this time as I am not convinced it is very useful. I have no aversion to accepting a good PR; rather, I just do not feel motivated to investigate and implement the SASL connection.