Opened 12 years ago
Closed 12 years ago
#19304 closed Uncategorized (invalid)
the mistake of the QuerySet Caching
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.4 |
Severity: | Normal | Keywords: | QuerySet Caching, Models get |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
hi Django Team,
may be I get some problem by following to django docs, in programe the Models logic,
the docs notice that get method get() https://docs.djangoproject.com/en/dev/ref/models/querysets/#get do not use a cache (see Caching and QuerySets). Rather, they query the database each time they're called. but when in fact I check the source /usr/local/lib/python2.7/dist-packages/django/db/models/manager.py line 130
def get(self, *args, kwargs):
return self.get_query_set().get(*args, kwargs)
the method is use the cache of the querySet , and I need some help to know How do I use a query get() DO NOT Use a Cache, thanks many, btw sorry about my English.
Rex
No,
get_query_set()
is only creating a new QuerySet instance.Please don't use the ticket system for usage question (see TicketClosingReasons/UseSupportChannels).