PATH:
opt
/
alt
/
tests
/
alt-php85-pecl-memcached_3.2.0-3.el8
/
tests
<?php $server = new MemcachedServer(); $server->on (Memcached::ON_CONNECT, function ($remote_addr) { echo "Incoming connection from {$remote_addr}" . PHP_EOL; return Memcached::RESPONSE_SUCCESS; }); $server->on (Memcached::ON_ADD, function ($client_id, $key, $value, $flags, $expiration, &$cas) { echo "client_id=[$client_id]: Add key=[$key], value=[$value], flags=[$flags], expiration=[$expiration]" . PHP_EOL; $cas = 15; return Memcached::RESPONSE_SUCCESS; }); $server->on (Memcached::ON_APPEND, function ($client_id, $key, $value, $cas, &$result_cas) { echo "client_id=[$client_id]: Append key=[$key], value=[$value], cas=[$cas]" . PHP_EOL; return Memcached::RESPONSE_SUCCESS; }); $server->on (Memcached::ON_PREPEND, function ($client_id, $key, $value, $cas, &$result_cas) { echo "client_id=[$client_id]: Prepend key=[$key], value=[$value], cas=[$cas]" . PHP_EOL; return Memcached::RESPONSE_SUCCESS; }); $server->on (Memcached::ON_INCREMENT, function ($client_id, $key, $delta, $initial, $expiration, &$result, &$result_cas) { echo "client_id=[$client_id]: Incrementing key=[$key], delta=[$delta], initial=[$initial], expiration=[$expiration]" . PHP_EOL; return Memcached::RESPONSE_SUCCESS; }); $server->on (Memcached::ON_DECREMENT, function ($client_id, $key, $delta, $initial, $expiration, &$result, &$result_cas) { echo "client_id=[$client_id]: Decrementing key=[$key], delta=[$delta], initial=[$initial], expiration=[$expiration]" . PHP_EOL; return Memcached::RESPONSE_SUCCESS; }); $server->on (Memcached::ON_DELETE, function ($client_id, $key, $cas) { echo "client_id=[$client_id]: Delete key=[$key], cas=[$cas]" . PHP_EOL; return Memcached::RESPONSE_SUCCESS; }); $server->on (Memcached::ON_FLUSH, function ($client_id, $when) { echo "client_id=[$client_id]: Flush when=[$when]" . PHP_EOL; return Memcached::RESPONSE_SUCCESS; }); $server->on (Memcached::ON_GET, function ($client_id, $key, &$value, &$flags, &$cas) { echo "client_id=[$client_id]: Get key=[$key]" . PHP_EOL; $value = "Hello to you client!"; return Memcached::RESPONSE_SUCCESS; }); $server->on (Memcached::ON_NOOP, function ($client_id) { echo "client_id=[$client_id]: Noop" . PHP_EOL; return Memcached::RESPONSE_SUCCESS; }); $server->on (Memcached::ON_REPLACE, function ($client_id, $key, $value, $flags, $expiration, $cas, &$result_cas) { echo "client_id=[$client_id]: Replace key=[$key], value=[$value], flags=[$flags], expiration=[$expiration], cas=[$cas]" . PHP_EOL; return Memcached::RESPONSE_SUCCESS; }); $server->on (Memcached::ON_SET, function ($client_id, $key, $value, $flags, $expiration, $cas, &$result_cas) { echo "client_id=[$client_id]: Set key=[$key], value=[$value], flags=[$flags], expiration=[$expiration], cas=[$cas]" . PHP_EOL; return Memcached::RESPONSE_SUCCESS; }); $server->on (Memcached::ON_STAT, function ($client_id, $key, array &$values) { echo "client_id=[$client_id]: Stat key=[$key]" . PHP_EOL; if ($key === "scalar") { $values = "you want it, you get it"; } elseif ($key === "numeric array") { $values = [-1 => "one", "two", "three"]; } elseif ($key === "empty") { $values = []; } else { $values["key"] = $key; $values["foo"] = "bar"; } return Memcached::RESPONSE_SUCCESS; }); $server->on (Memcached::ON_VERSION, function ($client_id, &$value) { echo "client_id=[$client_id]: Version" . PHP_EOL; $value = "1.1.1"; return Memcached::RESPONSE_SUCCESS; }); $server->on (Memcached::ON_QUIT, function ($client_id) { echo "client_id=[$client_id]: Client quit" . PHP_EOL; return Memcached::RESPONSE_SUCCESS; }); $addr = ($_SERVER['argv'][1] ?? "127.0.0.1:3434"); echo "Listening on $addr" . PHP_EOL; $server->run($addr);
[-] no-not-found.phpt
[edit]
[-] types_json_multi.phpt
[edit]
[-] session_lazy_warning.phpt
[edit]
[-] session_badconf_prefix.phpt
[edit]
[-] types_msgpack_multi.phpt
[edit]
[-] bug_17137.phpt
[edit]
[-] check_key.phpt
[edit]
[-] cas.phpt
[edit]
[-] pr_75.phpt
[edit]
[-] localserver.phpt
[edit]
[-] getserverbykey.phpt
[edit]
[-] reset_keyprefix.phpt
[edit]
[-] construct_persistent.phpt
[edit]
[-] set_large.phpt
[edit]
[-] cachecallback.phpt
[edit]
[-] sasl_basic.phpt
[edit]
[-] session_lock.phpt
[edit]
[-] memcachedserver6.phpt
[edit]
[-] server.php
[edit]
[-] vbucket.phpt
[edit]
[-] setmulti.phpt
[edit]
[-] gh_90.phpt
[edit]
[-] types_php.phpt
[edit]
[-] 001.phpt
[edit]
[-] types_igbinary.phpt
[edit]
[-] rescode.phpt
[edit]
[-] check_if_pristine.phpt
[edit]
[-] append.phpt
[edit]
[-] types_json.phpt
[edit]
[-] session_badconf_locktime.phpt
[edit]
[-] invalid_options.phpt
[edit]
[-] session_basic.phpt
[edit]
[-] expire.phpt
[edit]
[-] testdata.res
[edit]
[-] types_msgpack.phpt
[edit]
[-] session_badconf_persistent.phpt
[edit]
[-] compression_types.phpt
[edit]
[-] server.inc
[edit]
[-] session_basic2.phpt
[edit]
[-] bug_18639.phpt
[edit]
[-] set_encoding_key2.phpt
[edit]
[-] invoke_callback_twice.phpt
[edit]
[-] incrdecr_initial.phpt
[edit]
[-] session_persistent.phpt
[edit]
[-] multi_order.phpt
[edit]
[-] get_flags.phpt
[edit]
[-] session_badconf_servers.phpt
[edit]
[-] gh_500.phpt
[edit]
[-] session_regenerate.phpt
[edit]
[-] gh_21.phpt
[edit]
[-] setoptions.phpt
[edit]
[-] keys_binary.phpt
[edit]
[-] bad_construct.phpt
[edit]
[-] check_if_persistent.phpt
[edit]
[-] getmulti.phpt
[edit]
[-] invoke_callback.phpt
[edit]
[-] getdelayed.phpt
[edit]
[-] incrdecr_invalid_key.phpt
[edit]
[-] gh_93.phpt
[edit]
[-] touch_binary.phpt
[edit]
[-] memcachedserver.phpt
[edit]
[-] deleted.phpt
[edit]
[-] callback_exception.phpt
[edit]
[-] vbucket_error_8.phpt
[edit]
[-] bad_construct_8.phpt
[edit]
[-] options.phpt
[edit]
[-] stats.phpt
[edit]
[-] gh_155.phpt
[edit]
[-] incrdecr.phpt
[edit]
[-] session_badconf_servers-php72.phpt
[edit]
[-] undefined_set.phpt
[edit]
[+]
..
[-] session_badconf_emptyprefix.phpt
[edit]
[-] gh_77.phpt
[edit]
[-] bug_16084.phpt
[edit]
[-] default_behavior.phpt
[edit]
[-] replace.phpt
[edit]
[-] user-flags.phpt
[edit]
[-] bug_16959.phpt
[edit]
[-] types_php_multi.phpt
[edit]
[-] invoke_callback_2.phpt
[edit]
[-] session_basic3.phpt
[edit]
[-] cas_multi.phpt
[edit]
[-] getserverlist.phpt
[edit]
[-] deletemultitypes.phpt
[edit]
[-] version.phpt
[edit]
[-] clone.phpt
[edit]
[-] session_lock-php71.phpt
[edit]
[-] types_igbinary_multi.phpt
[edit]
[-] incrdecr_64.phpt
[edit]
[-] deletemulti.phpt
[edit]
[-] stats_hang.phpt
[edit]
[-] vbucket_error_7.phpt
[edit]
[-] incrdecr_bykey.phpt
[edit]
[-] types.inc
[edit]
[-] prepend.phpt
[edit]
[-] flush_buffers.phpt
[edit]
[-] keys_ascii.phpt
[edit]
[-] construct.phpt
[edit]
[-] config.inc
[edit]
[-] conf_persist.phpt
[edit]
[-] skipif.inc
[edit]
[-] callback_exception_2.phpt
[edit]
[-] add.phpt
[edit]