0

I set 3 cache values with timeout and get the expiration times with cache._expire_info in LocMemCache as shown below:

from django.core.cache import cache

cache.set("name", "John", timeout=60)
cache.set("age", 36, timeout=120)
cache.set("gender", "Male", timeout=180)

print(cache._expire_info)

But, the expiration times are hidden in numbers as shown below:

{':1:name': 1692720916.654848, ':1:age': 1692720976.654848, ':1:gender': 1692721036.654848}

Actually, the result which I expected is as shown below:

{':1:name': 60, ':1:age': 120, ':1:gender': 180}

So, how can I get the expiration times of the cache values properly in Django?

Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129

0 Answers0