Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $MC = new Memcached;
- $MC->setOption(Memcached::OPT_BINARY_PROTOCOL, true); // Removing this causes the code to work, but at the 'expense' of reverting to the ASCII protocol
- $MC->addServer('10.10.10.5', 64261);
- $KeyList = Array (
- 'GTID:%09%5d%3bhe)j3sq',
- 'GTID:%09%5d%3bhe)j2q%03',
- 'GTID:%09%5d%3bhe)j3%03%07',
- 'GTID:%09%5d%3bhe)j2s%05',
- 'GTID:%09%5d%3bhe)j2%7c%09',
- 'GTID:%09%5d%3bhe)j2%7d%7b',
- 'GTID:%09%5d%3bhe)j3rx',
- 'GTID:%09%5d%3a%15%18*iAr%07',
- 'GTID:%09%5d%3a%13%1f%5c%1eGtw',
- 'GTID:%09%5d%3abn%2bi6%04%01',
- 'GTID:%09%5d%3bhe)j%3c%0ft',
- 'GTID:%09%5d%3abn%5c%1e9%7e%0a',
- 'GTID:%09%5d%3bhe)j3p%01',
- 'GTID:%09%5d%3a%15%18*iN%0er',
- 'GTID:%09%5d%3a%15%18*iAss',
- 'GTID:%09%5d%3a%15%18*iNe4X6z-17t'
- );
- $Test = Array();
- foreach ($KeyList as $k) {
- $Test[$k] = "My Key is $k!";
- }
- // This block uses the *Multi() functions
- $MC->setMulti($Test, 3600);
- sleep(1);
- $theList = $MC->getMulti($KeyList);
- print_r($theList); // Verify that all keys are intact
- foreach ($theList as $K => $V) {
- echo isset($theList[$K]) ? str_pad($K, 40)." Found: \"{$theList[$K]}\"\n" : str_pad($K, 40)." NOT Found\n";
- }
- /* ===== */
- /*
- // This block uses single get/set operations, which do not exhibit the same issues
- foreach ($Test as $K => $V) {
- $MC->set($K, $V, 3600);
- }
- sleep(1);
- foreach ($Test as $K => $V) {
- echo ($Res = $MC->get($K)) ? str_pad($K, 40)." Found:" : str_pad($K, 40)." NOT Found:";
- echo "\t\"$Res\"\n";
- }
- */
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement