💭 DiskCache API Reference — DiskCache 5.6.1 documentation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

!https://grantjenks.com/docs/diskcache/api.html#diskcache.Cache.peekitem

Date: July 3, 2024

Image: https://grantjenks.com/docs/diskcache/api.html#diskcache.Cache.peekitem </static/https://grantjenks.com/docs/diskcache/api.html#diskcache.Cache.peekitem>

diskcache has a peekitem method that allows you to lookup the expire_time of a cached item without changing it. I recently used this to implement debounce for [4m[38;2;248;248;242mfastapi[0m <[38;2;248;248;242m/fastapi/[0m> background tasks with multiple workers running. since all the workers I care about are on the same machine, but running in different processes diskcache was a great option. All workers have access to the same disk, but not the same variables in memory.

[38;2;68;71;90mNOTE[0m
[38;2;68;71;90m│ [0mThis post is a [4m[38;2;248;248;242mthought[0m <[38;2;248;248;242m/thoughts/[0m>. It’s a short note that I make about someone else’s content online #thoughts
