How can I change the default cache time of memcached ?, Memcached Cache
When we use the memcached extension of php to add data to memcached, there are two methods for data validity. For example.
AsSet a UNIX timestamp or an integer in seconds (time difference from the current time) to indicate the data expiration time. However, in the next setting method, cannot exceed 2592000 seconds (30 days)What should we do? We do not want to set it to permanently valid, but we do not want to limit it to 30 days. Here we use the code in the official document as an example code, as shown below.
<? Php
$ Memcache_obj = memcache_connect ("localhost", 11211 );
/* Process-oriented 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
?>
For more articles, please pay attention to love blog