When we use PHP's memcached extension to add data to the memcached, there are two ways in which the data will be available in time. Such as.
As for the setting of a Unix timestamp or an integer in seconds (from the current calculated time difference) to indicate the expiration of this data, but in the latter setting, not more than 2.592 million seconds (30 days) problem What should we do? We don't want to be permanently valid, but we don't want to limit it to 30 days. So here's the way, here's the code for the official document as the sample code, as follows.
<?php
$memcache _obj = Memcache_connect ("localhost", 11211);
/* For process programming API */
Memcache_add ($memcache _obj, ' var_key ', ' Test variable ', false, 0);//permanently valid
/* Object-oriented Programming API */
$memcache _obj->add (' Var_key ', ' Test variable ', false, Time () +24*60*60*30);//More than 30 days
?>
More on the article please focus on love Blog
How do I change the default cache time for memcached?