Hi,
I'm using Memcached PHP library (based on libmemcached) and I'm wondering how can I change predefined constants in PHP. I'd like to use key distribution based on ketama.
Memcached is compiled as a PHP extension.
Thank you.
Hi,
I'm using Memcached PHP library (based on libmemcached) and I'm wondering how can I change predefined constants in PHP. I'd like to use key distribution based on ketama.
Memcached is compiled as a PHP extension.
Thank you.
I don't think you can. The memcached settings are decided when the php extension is compiled I believe. If you really need to use different settings for memcached, compile a number of different memcached extension files (each with a different configuration), give each a suitable name, and then use the dl function (http://uk3.php.net/dl), to load the correct one at runtime.
(This does of course assume you have control over the server.)
use setOption:
$this->_Memcache =& new Memcached();
$this->_Memcache->setOption(Memcached::OPT_SERIALIZER, Memcached::SERIALIZER_PHP);
$this->_Memcache->setOption(Memcached::OPT_NO_BLOCK, true);
$this->_Memcache->setOption(Memcached::OPT_TCP_NODELAY, true);
$this->_Memcache->setOption(Memcached::OPT_BUFFER_WRITES, true);
$this->_Memcache->setOption(Memcached::OPT_SERVER_FAILURE_LIMIT,3);
$this->_Memcache->setOption(Memcached::OPT_HASH,Memcached::HASH_CRC);
etc... etc...