Caches your Django ORM queries and automatically invalidates them.
Cachalot officially supports Python 3.6-3.9 and Django 2.2 and 3.1-3.2 with the databases PostgreSQL, SQLite, and MySQL.
Note: an upper limit on Django version is set for your safety. Please do not ignore it.
pip install django-cachalot
- If you use multiple servers with a common cache server, double check their clock synchronisation
- If you modify data outside Django – typically after restoring a SQL database –, use the manage.py command
- Be aware of the few other limits
- If you use django-debug-toolbar, you can add
To start developing, install the requirements and run the tests via tox.
Make sure you have the following services:
pip install -r requirements/hacking.txt
- For PostgreSQL:
CREATE ROLE cachalot LOGIN SUPERUSER;
tox --current-envto run the test suite on your current Python version.
- You can also run specific databases and Django versions:
tox -e py38-django3.1-postgresql-redis
Currently, benchmarks are supported on Linux and Mac/Darwin. You will need a database called "cachalot" on MySQL and PostgreSQL. Additionally, on PostgreSQL, you will need to create a role called "cachalot." You can also run the benchmark, and it'll raise errors with specific instructions for how to fix it.
pip install -r requirements/benchmark.txt
The output will be in benchmark/TODAY'S_DATE/
TODO Create Docker-compose file to allow for easier running of data.