note 112236 added to memcache.get
| From: | bijay dot rungta at gmail dot com | Date: | Tue, 21 May 2013 06:32:04 +0000 |
| Subject: | note 112236 added to memcache.get | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-194868@lists.php.net to get a copy of this message | ||
Note that if you include spaces in your keys when saving Data and use array of keys to get the Data,
The returned array will replace spaces with underscores in the keys.
<?php
$memcache = new Memcache;
$memcache->connect('localhost');
$memcache->set('my-key', 'value1', 0, 300);
$memcache->set('key with space', 'value 2', 0, 300);
print_r($memcache->get(array('my-key', 'key with space'))); // Array (
[my-key] => value1 [key_with_space] => value 2 )
?>
Memcache replaces spaces with underscores when saving, it does so when doing a get too, but when you
do a get with single key (string) you don't notice this as it merely returns the value. But
when you do a get for array of keys, you would expect the same keys in the returned array but it
replaces spaces by underscores in them.
----
Server IP: 59.162.86.123
Probable Submitter: 61.16.155.194
----
Manual Page -- http://php.net/manual/en/memcache.get.php
Edit -- https://master.php.net/note/edit/112236
Del: integrated -- https://master.php.net/note/delete/112236/integrated
Del: useless -- https://master.php.net/note/delete/112236/useless
Del: bad code -- https://master.php.net/note/delete/112236/bad+code
Del: spam -- https://master.php.net/note/delete/112236/spam
Del: non-english -- https://master.php.net/note/delete/112236/non-english
Del: in docs -- https://master.php.net/note/delete/112236/in+docs
Del: other reasons-- https://master.php.net/note/delete/112236
Reject -- https://master.php.net/note/reject/112236
Search -- https://master.php.net/manage/user-notes.php