Memcached generally sets expire to automatically delete expired files, and then {code ...} redis's PHPAPI only has one setex to set the expiration time. Other lists and zset are not displayed. If not, the cache that is not set will always exist and the memory will keep increasing? What if the cache is updated? memcached usually sets expire to automatically delete expired files. Then
$arr = $mem->get($key);if(empty($arr)){$sql = "select ....";$arr = $pdo->fetch();$mem->set($key,$arr,10*60);}
Redis's php api only has one setex to set the expiration time. Other lists and zset are not displayed. If not, the cache is not set and the memory is continuously increasing? How can I maintain the updated cache?
In fact, what I want to ask is the redis update policy. The zset data is always in the memory. How can I maintain updates? If memcache has a poor performance period, why is it not designed?
Reply content:
Memcached generally sets expire to automatically delete expired files, and then
$arr = $mem->get($key);if(empty($arr)){$sql = "select ....";$arr = $pdo->fetch();$mem->set($key,$arr,10*60);}
Redis's php api only has one setex to set the expiration time. Other lists and zset are not displayed. If not, the cache is not set and the memory is continuously increasing? How can I maintain the updated cache?
In fact, what I want to ask is the redis update policy. The zset data is always in the memory. How can I maintain updates? If memcache has a poor performance period, why is it not designed?
For general keysEXPIRE
Command. Http://redis.io/commands/expire
Ttl does not exist all the time.set
The update overwrites the original value.
List, zset can also set the expiration time, both use the EXPIRE command
It is usually set as needed