How does Redis implement the expiration of keys? From here I learnt that Redis stores the time at which the key will expire, but how exactly is this implemented?
For the Redis 6, from the release notes:
The expiration cycle has been rewritten in Redis 6.0 to allow for much faster expirations that more closely match the time-to-live (TTL) property. Redis 6 expiration will no longer be based on random sampling but will take keys sorted by expire time in a radix tree