Redis uses lazy-expiration to delete stale keys, that is when a command touches a expired key, it should delete the key and propagate the deletion at first.

But there are many bugs in past, present and maybe future... time is a too flexible variable.

  1. delete expired keys in EVAL may cause data inconsistency after replication, discussed in #1525, fixed
  2. time's change breaks command's atomicity and cause server crash in some commands like SPOP and BRPOPLPUSH, discussed in #6152, fixed in #6615 by introduce time snapshot
  3. wrapping expire-dels in a transaction to propagate but leads to CROSSSLOT replication in SCAN and RANDOMKEY, introduced in #9890 and fixed in #11788
  4. wrapping write command and expire-dels in a transaction to propagate, introduced in #9890, not fixed
  5. SCAN in MULTI/EXEC triggers expire-dels and expire-dels wrapped in a transaction to propagate, leads to CROSSSLOT replication, not fixed
  6. Modules + notifications may cause unwanted propagation #10014 not fixed
  7. maybe some other cases around scripts and module