Opened 10 years ago

Closed 9 years ago

#3766 closed (fixed)

[patch] django.contrib.sites should cache to reduce queries like contenttypes does

Reported by: David Cramer <dcramer@…> Owned by: nobody
Component: Contrib apps Version: master
Severity: Keywords: sites
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

As you did with the CONTENT_TYPE_CACHE I would suggest the same be applied with the django.contrib.sites app so that multiple calls to get current (and similar) are not extra queries

Attachments (3)

site_cache.diff (1.5 KB) - added by Matt Riggott 9 years ago.
Patch to add Site object caching to django.contrib.sites.models.SiteManager
sites_docs.diff (1.3 KB) - added by Matt Riggott 9 years ago.
Documentation on the caching and the Site.objects.clear_cache() method.
sites_docs.2.diff (1.3 KB) - added by Matt Riggott 9 years ago.
Formatting changes to the docs diff: lines wrapped at 80 characters and a "New in Django development version" notice added.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 10 years ago by Simon G. <dev@…>

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Summary: Site Cachingdjango.contrib.sites should cache to reduce queries like contenttypes does
Triage Stage: UnreviewedAccepted

Where CONTENT_TYPE_CACHE is that which is implemented in django.contrib.contenttypes.models

Changed 9 years ago by Matt Riggott

Attachment: site_cache.diff added

Patch to add Site object caching to django.contrib.sites.models.SiteManager

comment:2 Changed 9 years ago by Matt Riggott

Has patch: set
Summary: django.contrib.sites should cache to reduce queries like contenttypes does[patch] django.contrib.sites should cache to reduce queries like contenttypes does

Changed 9 years ago by Matt Riggott

Attachment: sites_docs.diff added

Documentation on the caching and the Site.objects.clear_cache() method.

comment:3 Changed 9 years ago by Simon G. <dev@…>

Triage Stage: AcceptedReady for checkin

Changed 9 years ago by Matt Riggott

Attachment: sites_docs.2.diff added

Formatting changes to the docs diff: lines wrapped at 80 characters and a "New in Django development version" notice added.

comment:4 Changed 9 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [6180]) Fixed #3766 -- Added in-memory caching for the sites framework. Will speed up all the "current site" lookups. Thanks, Matt Riggott.

Note: See TracTickets for help on using tickets.
Back to Top