I keep a set of end-to-end API checks: hundreds of real HTTP requests run in order against a local server, each with an expected answer. One of them uses up a "5 changes a day" limit on purpose, then checks that the 6th is refused.
On a rerun it failed on the very first change. My reset wiped the database, but the limit counter lived in cache files on disk. The test user came back with the same id, still at 5 of 5.
The fix:
Before:
After:
Keep that run's cache in its throwaway database, so one reset clears data and counters together. Memory wouldn't work here: each request is a separate process, so the counter would never reach 6.
CACHE_STORE=file
CACHE_STORE=database
commit d82eaa2