note 118157 added to memcached.set
| From: | PeterN | Date: | Fri, 16 Oct 2015 11:48:14 +0000 |
| Subject: | note 118157 added to memcached.set | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-203969@lists.php.net to get a copy of this message | ||
In the example it shows:
/* expire 'object' key in 5 minutes */
$m->set('object', new stdclass, time() + 300);
But this is wrong.
It will not expire, at least, not for a long long time.
So instead of time() + seconds, you use:
$m->set('object', new stdclass, 300);
And it will correctly expire after 5 minutes.
Note: Using memcached 2.1.0 stable through PECL.
----
Server IP: 72.52.91.14
Probable Submitter: 92.111.5.18
----
Manual Page -- http://php.net/manual/en/memcached.set.php
Edit -- https://master.php.net/note/edit/118157
Del: integrated -- https://master.php.net/note/delete/118157/integrated
Del: useless -- https://master.php.net/note/delete/118157/useless
Del: bad code -- https://master.php.net/note/delete/118157/bad+code
Del: spam -- https://master.php.net/note/delete/118157/spam
Del: non-english -- https://master.php.net/note/delete/118157/non-english
Del: in docs -- https://master.php.net/note/delete/118157/in+docs
Del: other reasons-- https://master.php.net/note/delete/118157
Reject -- https://master.php.net/note/reject/118157
Search -- https://master.php.net/manage/user-notes.php