Replies: 1 comment
|
I think this is a pretty reasonable gap to discuss. I’ve also found myself using I’d personally be in favor of having a few more common patterns supported or at least documented in Even just having some recommended, standard approaches for things like async memoization, TTL, and invalidation would make things easier. It would save people from having 20 slightly different implementations of the same “simple” cache scattered across projects. So yeah, I’d definitely be interested in seeing what a minimal API for this could look like without making |
Uh oh!
There was an error while loading. Please reload this page.
While working on optimizing some data-heavy internal pipelines, I noticed an interesting pattern regarding how we handle function caching and memoization across various utilities.
Currently, developers frequently reach for external packages or write custom lightweight decorators when dealing with transient caching needs, even though
functools.lru_cacheis robust and built right into the standard library. However,functools.lru_cachecan sometimes feel a bit rigid for modern asynchronous code, or when dealing with automatic cache invalidation, memory footprint limits without fixed bounds, or TTL (Time-To-Live) constraints without pulling in heavy third-party dependencies likecachetools.I wanted to open a discussion on whether there's any appetite in the community or core development team to:
functools(e.g., native TTL support or memory-bounded variants that don't require manual maxsize tuning).All reactions