3 ms·
This is a pretty good implementation. I like the simplicity of it, reminds me of SQLite backed storage decorators we used to have, where the data was persisted
by skp1995 3y ago
This is a pretty good implementation. I like the simplicity of it, reminds me of SQLite backed storage decorators we used to have, where the data was persisted to a DB instead of the file system (altho thats just a different storage engine)
Does this also take care of the thundering heard problem? That was one of the cases where lru_cache really blows
- williamzeng0 3y agoUnfortunately it doesn't, we typically don't expect to handle high load with this cache and actually disable it in production with another envvar. Sometimes caching can actually be slower for certain functions, because just performing that operation is faster than pickle.load/pickle.dump.