Closed shikhart98 closed 2 years ago
By default cacheops presumes queries do not depend on database, which is desirable for a very common master-replica case. If you want those queries to be separate you need to set db_agnostic
option to False
, see https://github.com/Suor/django-cacheops#multiple-database-support
I have 2 DBs:
In my Django setting for the purpose of testing and running unit test cases, I have configured replica to mirror default DB. I was writing test case with the following scenario:
-> read request (using default DB): makes a query to DB to count the number of rows in a table. -> read request (using replica DB): makes a query to DB to count the number of rows in a table. -> insert request (using default DB) -> read request (using default DB): makes a query to db to count the number of rows in a table. -> read request (using replica DB): returns the count from cache (incorrect, should have queried DB).
Should cacheops not read the mirror property in case of TESTing, and maintain (sync) the list of transaction state it maintains for different database aliases?