����JFIF��x�x����'
Server IP : 78.140.185.180 / Your IP : 3.137.136.226 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/cpanel/ea-php74/root/usr/share/tests/pecl/memcached/tests/ |
Upload File : |
--TEST-- Test for GH #90 --SKIPIF-- <?php include "skipif.inc";?> --FILE-- <?php include dirname (__FILE__) . '/config.inc'; $memcached = memc_get_instance (array ( Memcached::OPT_BINARY_PROTOCOL => true )); // Create a key for use as a lock. If this key already exists, wait till it doesn't exist. { $key = 'LockKey'; $lockToken = mt_rand(0, mt_getrandmax()); //Random value for ownership verification while (true) { $casToken = null; $data = $memcached->get($key, $casToken); if ($memcached->getResultCode() == Memcached::RES_NOTFOUND) { if ($memcached->add($key, $lockToken, 5)) { break; } } elseif ($data === false) { if ($memcached->cas($casToken, $key, $lockToken, 5)) { break; } } //Sleep 10 milliseconds usleep(10 * 1000); } } //Do something here that requires exclusive access to this key //Effectively delete our key lock. { $casToken = null; if ($lockToken == $memcached->get($key, $casToken)) { $memcached->cas($casToken, $key, false, 1); } } //Create 10 keys and then increment them. The first value returned will be wrong. { $keyList = array(); for ($i = 0; $i < 10; $i++) { $keyList[] = $i . '_' . uniqid ('count_value_'); } $valueList = array(); foreach ($keyList as $key) { $valueList[$key] = $memcached->increment($key, 1, 1); } var_dump ($valueList); } --EXPECTF-- array(10) { ["0_%s"]=> int(1) ["1_%s"]=> int(1) ["2_%s"]=> int(1) ["3_%s"]=> int(1) ["4_%s"]=> int(1) ["5_%s"]=> int(1) ["6_%s"]=> int(1) ["7_%s"]=> int(1) ["8_%s"]=> int(1) ["9_%s"]=> int(1) }