Memcache::set
Store data at the server
&reftitle.description;
boolMemcache::set
stringkey
mixedvar
intflag
intexpire
Memcache::set stores an item
var with key on the
memcached server. Parameter expire is expiration
time in seconds. If it's 0, the item never expires (but memcached server
doesn't guarantee this item to be stored all the time, it could be deleted
from the cache to make place for other items).
You can use MEMCACHE_COMPRESSED constant as
flag value if you want to use on-the-fly
compression (uses zlib).
Remember that resource variables (i.e. file and connection descriptors)
cannot be stored in the cache, because they cannot be adequately
represented in serialized state.
Also you can use memcache_set function.
&reftitle.parameters;
key
var
flag
expire
&reftitle.returnvalues;
&return.success;
&reftitle.examples;
Memcache::set example
]]>
Memcache::set example
connect('memcache_host', 11211);
/*
set value of item with key 'var_key', using on-the-fly compression
expire time is 50 seconds
*/
$memcache_obj->set('var_key', 'some really big variable', MEMCACHE_COMPRESSED, 50);
echo $memcache_obj->get('var_key');
?>
]]>
&reftitle.seealso;
Memcache::add
Memcache::replace