Reputation: 2786
I have enabled basic Django query caching by adding the following to my settings.py
:-
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'trialrun_cache_table'
}
}
Does Django automatically invalidate query cache for a particular table if data is inserted or updated? If not, How should I go about implementing this behavior?
Upvotes: 3
Views: 322
Reputation: 600059
I think you've misunderstood what the DatabaseCache is. It is not a cache of your database, it's a cache in your database; that is, when you explicitly cache something, it'll be stored in a table in your db. It's still up to you to actually do any caching, and similarly it's up to you to do any cache invalidation.
Upvotes: 2