django-cacheops icon indicating copy to clipboard operation
django-cacheops copied to clipboard

Support for cache invalidation on `bulk_update()` method

Open ashwani99 opened this issue 1 year ago • 3 comments

Currently, support for bulk_create() is present but not bulk_update(). Any thoughts on adding this?

Some inspiration can be taken from https://github.com/Suor/django-cacheops/issues/136

ashwani99 avatar Jan 21 '24 19:01 ashwani99

.bulk_create() is already invalidated, you can look at the code in here. Unlike .bulk_update() it already had all changed objects with all their fields, do it doesn't require extra database queries to invalidate.

Suor avatar Jan 23 '24 02:01 Suor

Hi @Suor .. not sure why this was closed? It doesn't indicate the problem was resolved.

I have started to use bulk_update and realised the updates were not invalidated in the cache leading to strange behaviour in the application.

Is it best not to use bulk_update when using django-cacheops?

pg1671 avatar Jul 07 '24 04:07 pg1671

Not sure why I closed this. There might be no efficient way to handle this though, requires some investigation.

Suor avatar Jul 07 '24 04:07 Suor