On Sun, Oct 30, 2011 at 8:48 AM, Jim Dalton <jim.dal...@gmail.com> wrote: ... > Anyhow, I honestly agree with you and Aymeric that a simple cache.clear() is > fine, but I thought the CLEAR_BETWEEN_TESTS flag was a good way to answer any > objections that we should be cautious about clearing the cache. If there are > no such objections, let's just do a simple cache.clear() then. It's literally > a single line of code in the test runner, along with a test and a note in the > docs. I can do that work as soon as some kind of consensus is reached. > > Thanks for your feedback.
I locally have a test-runner class that calls .clear() on setUp. Works for me. But we run CI, so test against prod. I needed to point to different CACHES under test to avoid flushing prod cache 20 times per day. Another approach that can work is to have the test runner generate a unique key prefix for each test run. Then the keys will all be misses on later runs. If invading the available key length isn't acceptable, then the test runner could also have a custom KEY_FUNCTION to hash the resulting key. A downside is that this can create significant pressure on the cache. I think that is less bad than clearing cache, though, since that is effectively infinite cache pressure. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.