mirror of
https://github.com/php-win-ext/php-memcached.git
synced 2026-03-24 17:12:22 +01:00
Add a configuration option to enforce an item size limit on the client side. This avoids sending large items over the wire and getting rejected by the server which can cause delays. The default is 0 for no limit. The same error code RES_E2BIG is used for the client side limit as for the server side limit.
49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
--TEST--
|
|
Set options using setOptions
|
|
--SKIPIF--
|
|
<?php include "skipif.inc";?>
|
|
--FILE--
|
|
<?php
|
|
$m = new Memcached();
|
|
|
|
/* existing options */
|
|
var_dump($m->setOptions(array(
|
|
Memcached::OPT_PREFIX_KEY => 'a_prefix',
|
|
Memcached::OPT_SERIALIZER => Memcached::SERIALIZER_PHP,
|
|
Memcached::OPT_COMPRESSION => 0,
|
|
Memcached::OPT_LIBKETAMA_COMPATIBLE => 1,
|
|
Memcached::OPT_CONNECT_TIMEOUT => 5000,
|
|
Memcached::OPT_ITEM_SIZE_LIMIT => 1000000,
|
|
)));
|
|
|
|
var_dump($m->getOption(Memcached::OPT_PREFIX_KEY) == 'a_prefix');
|
|
var_dump($m->getOption(Memcached::OPT_SERIALIZER) == Memcached::SERIALIZER_PHP);
|
|
var_dump($m->getOption(Memcached::OPT_COMPRESSION) == 0);
|
|
var_dump($m->getOption(Memcached::OPT_LIBKETAMA_COMPATIBLE) == 1);
|
|
var_dump($m->getOption(Memcached::OPT_ITEM_SIZE_LIMIT) == 1000000);
|
|
|
|
echo "test invalid options\n";
|
|
|
|
var_dump($m->setOptions(array(
|
|
"asdf" => 123
|
|
)));
|
|
|
|
var_dump($m->setOptions(array(
|
|
-1 => 123
|
|
)));
|
|
|
|
--EXPECTF--
|
|
bool(true)
|
|
bool(true)
|
|
bool(true)
|
|
bool(true)
|
|
bool(true)
|
|
bool(true)
|
|
test invalid options
|
|
|
|
Warning: Memcached::setOptions(): invalid configuration option in %s on line %d
|
|
bool(false)
|
|
|
|
Warning: Memcached::setOptions(): error setting memcached option: %s in %s on line %d
|
|
bool(false)
|