Let’s Write a Composable, Easy-to-Use Caching Package in Python | by Mike Huls | Aug, 2024

Editor
1 Min Read


Easy, user-friendly caching that tailors to all your needs

Python choosing a caching strategy (image by ChatGPT + amateuristic edits by author)

In this article we’ll walk through the process of building a caching system in python from the ground up. The goal is to…

  • better understand caching and explore various caching strategies
  • understand why we went for a composition-approach over inheritance
  • learn how and when to apply a cache effectively

We’ll focus on building a user-friendly package that allows you to easily add caches to your code. Additionally, we’ll provide a simple means to extend the cache by providing it with self-designed behavior. Let’s code!

This article details creating caches that are part of the the Cachr package on PyPI. All code can be found in this Github repo. Contributions are always welcome; feel free to submit bug reports, bug fixes, feature requests, documentation improvements or enhancements!

Share this Article
Please enter CoinGecko Free Api Key to get this plugin works.