"Caching Best Practices" by: Moshe Zadka
Using a database? A microservice? Then you have probably considered whether to cache some of the data you retrieve from them. Caching is supposed to make the application go fast, right? Sometimes! Caching is a subtle topic. Using caches needs to be done with care. This care should manifest beforehand, by thinking ahead of time about the data needs and latencies involved. The care should manifest while writing the code, refactoring as appropriate to take proper advantage of the cache. The care must even be applied after the code is written, by monitoring cache hit/miss rates and alerting appropriately if the cache patterns change.
Using a cache well can make an application faster and cheaper to run. Using a cache badly can make an application slower, and consume more resources. Learn how to measure twice, and cache once.
Recorded at the 2021 Python Web Conference (https://2021.pythonwebconf.com)