What's default TTL in Redis?

There is no default TTL. By default, keys are set to live forever.


The keys with no expiration time set will not expire.

If you mean TTL command specifically, starting with v2.8, it will return -2 if no EXPIRE value is set.

Edit: Itamar Haber's comment is true, I recalled false: There is no such setting in redis config for a global TTL. So I deleted the part about that.

Edit2: Also see the link to the official docs about default expiration of keys here: https://redis.io/commands/expire#appendix-redis-expires

Tags:

Ttl

Redis