Why did my redis key expire before the deadline?

I installed the redis key and set its expiration time to a week:

$expireTime = 7*24*3600;

$redis->hSet($redisKey, $uniqueId, 1);
$redis->expire($redisKey, $expireTime);

But I found that the key may have expired in a few days, not a week. This is very unacceptable to me.

Has it expired since the key value is too large?

How to save a redis key as long as I expected?

My setting max-memoryis 4G, used_memory_peak_humanequal to 2.06G, and the eviction policy is the default volatile-lru.

+4
source share

All Articles