Memcached generally set expire expired automatically deleted, and then
$arr = $mem->get($key);if(empty($arr)){$sql = "select ....";$arr = $pdo->fetch();$mem->set($key,$arr,10*60);}
The Redis PHP API has only one Setex setting expiration time, other list,zset do not see, if not set the cache has been in existence, memory has been increasing? How do I maintain the cache if it is updated?
In fact, I want to ask is the Redis update strategy, ZSET data has been in memory, if the data are updated how to maintain it? If there is a failure period like memcache, but why is it not designed?
Reply content:
Memcached generally set expire expired automatically deleted, and then
$arr = $mem->get($key);if(empty($arr)){$sql = "select ....";$arr = $pdo->fetch();$mem->set($key,$arr,10*60);}
The Redis PHP API has only one Setex setting expiration time, other list,zset do not see, if not set the cache has been in existence, memory has been increasing? How do I maintain the cache if it is updated?
In fact, I want to ask is the Redis update strategy, ZSET data has been in memory, if the data are updated how to maintain it? If there is a failure period like memcache, but why is it not designed?
For the general key with the EXPIRE
command. Http://redis.io/commands/expire
Not setting the TTL will of course always exist. The set
update overwrites the original value.
List,zset can also set the expiration time, all using the EXPIRE command
It is usually set according to the requirements