#29625: Expose RelatedManager._remove_prefetched_objects as public method
-------------------------------------+-------------------------------------
Reporter: Ming Qin | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: prefetch_related, | Triage Stage: Accepted
_prefetched_objects_cache |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Ming Qin):
Replying to [comment:4 Simon Charette]:
> Could you confirm `refresh_from_db(fields=['authors'])` works on Django
2.1? If not this might be an omission in #29076.
No, it doesn't work. Still hits the cache. Tested on `master`, `2.1rc1`,
and `2.1`.
I'll be happy to fix `refresh_from_db`, instead of opening this new API.
Does the following behavior sound good?
1. If `refresh_from_db()` is called without argument, it **won't** clear
prefetched cache.
2. If it's called specifically with an related field, and that field is
many-to-many or many-to-one field, the prefetched cache **will** be
cleared.
--
Ticket URL: <https://code.djangoproject.com/ticket/29625#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.d7ffc69b9bde3720bfa290f208b89c6e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.