List Info

Thread: note 78022 added to function.memcache-set




note 78022 added to function.memcache-set
user name
2007-09-24 13:46:51
Here is a very visual example on how to use the memcache. It
sets the key 'time' to the current time.
Put the example code in an empty page and keep reloading
it.
As you can see, after 10 seconds your memcache key will be
able to update with a new timestamp.

<?php

$memcache_obj = new Memcache;
$memcache_obj->connect('127.0.0.1', 11211);

if ($memcache_obj->get('time') == "") {
        $date = date("H:i:s");
        $memcache_obj->set('time', $date,
MEMCACHE_COMPRESSED, 10);
}

echo "At ".date("H:i:s").", your
key is ".$memcache_obj->get('time');

?>
----
Server IP: 129.16.214.50
Probable Submitter: 83.248.142.57
----
Manual Page -- http://www.php.net/manual/en/function.memcache-set.php

Edit        -- https://master
.php.net/note/edit/78022
Del: integrated  -- h
ttps://master.php.net/note/delete/78022/integrated
Del: useless     -- http
s://master.php.net/note/delete/78022/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/78022/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/78022/spam
Del: non-english -- 
https://master.php.net/note/delete/78022/non-english
Del: in docs     -- http
s://master.php.net/note/delete/78022/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/78022
Reject      -- https://mast
er.php.net/note/reject/78022
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )