In runtime, I want to retrieve the expire time info about some items in memcached. I didn't find any related interface on memcached. Can I do this? something like: mc.get_expire_time('key')
Thank you
Python memcache API doesn't provide such functionalities. However you can telnet into memcached to dump all keys and expiration time.
> telnet localhost 11211
stats items
show the slabs that contain your data.
stats items
STAT items:12:number 1108
...
END
Then use stats cachedump slab_id count
to see the key and expiration time. Set count to 0 to retrieve all keys.
stats cachedump 12 1
ITEM abc [100 b; 1528336485 s]
END
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With