python-diskcache icon indicating copy to clipboard operation
python-diskcache copied to clipboard

Expose store_time in Cache.get?

Open wpietri opened this issue 1 year ago • 0 comments

For observability reasons, we'd like to log the age of cached elements when we use them. I was thinking of wrapping DiskCache so that we put the store time into the value, but looking at the underlying storage, I see that there's already a store_time column.

I suggest that the store_time property be exposed in the same way that expire_time currently is: a get call lets you say you want that and it comes back in a tuple.

Another way to approach this that might be more extensible is to have something like get_entry(key) -> dict which gives you back the whole row as a dict.

wpietri avatar Sep 20 '24 20:09 wpietri