Hi Shengyu Xiong •,
Welcome to Microsoft Q&A forum.
As I understand, you want to set default TTL in Azure Cache for Redis.
Choose an eviction policy that works for your application. The default policy for Azure Cache for Redis is volatile-lru
, which means that only keys that have a TTL value set with a command like EXPIRE are eligible for eviction. If no keys have a TTL value, then the system won't evict any keys. If you want the system to allow any key to be evicted if under memory pressure, then you may want to consider the allkeys-lru
policy.
volatile-ttl
: Removes the key with the shortest time to live based on the expiration set for it.
Hope this helps. Let us know for more queries.
Thanks