2014-10-28 22:44:28 +00:00
|
|
|
|
How django-cachalot works
|
|
|
|
|
|
-------------------------
|
|
|
|
|
|
|
2014-12-14 09:06:12 +00:00
|
|
|
|
.. note:: If you don’t understand, you can pretend it’s magic.
|
2014-10-28 22:44:28 +00:00
|
|
|
|
|
|
|
|
|
|
Reverse engineering
|
|
|
|
|
|
...................
|
|
|
|
|
|
|
|
|
|
|
|
It’s a lot of Django reverse engineering combined with a strong test suite.
|
|
|
|
|
|
Such a test suite is crucial for a reverse engineering project.
|
|
|
|
|
|
If some important part of Django changes and breaks the expected behaviour,
|
|
|
|
|
|
you can be sure that the test suite will fail.
|
|
|
|
|
|
|
|
|
|
|
|
Monkey patching
|
|
|
|
|
|
...............
|
|
|
|
|
|
|
2014-12-14 09:06:12 +00:00
|
|
|
|
Django-cachalot modifies Django in place during execution to add a caching tool
|
2014-10-28 22:44:28 +00:00
|
|
|
|
just before SQL queries are executed.
|
2014-12-14 09:06:12 +00:00
|
|
|
|
When a SQL query reads data, we save the result in cache. If that same query is
|
|
|
|
|
|
executed later, we fetch that result from cache.
|
2014-12-14 09:12:38 +00:00
|
|
|
|
When we detect ``INSERT``, ``UPDATE`` or ``DELETE``, we know which tables are
|
2014-12-14 09:06:12 +00:00
|
|
|
|
modified. All the previous cached queries can therefore be safely invalidated.
|