Code

#19334 closed Cleanup/optimization (duplicate)

Caching the current Site object into cache backend

Reported by: astafiev.anton@… Owned by: nobody
Component: contrib.sites Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

As it is described here current site object is cached.

I was very surprised, when it turned out, that this object is cached into sites.models.SITE_CACHE dictionary
I think, that Django should use the same cache engine everywhere. Caching into global objects could produce problems that are very hard to diagnose. Also, it is much easier to have only one interface to flush the cache.

I propose to use standard cache interface here. I could provide the patch, if you think it is reasonable.

Attachments (0)

Change History (4)

comment:1 Changed 17 months ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Not everyone has a cache configured.

comment:2 Changed 17 months ago by russellm

  • Resolution set to wontfix
  • Status changed from new to closed

As Aymeric points out, there's no guarantee that a cache backend is available.

The real problem here is that there is global state -- and while I'll agree that this is a problem, it's not a problem we fix by moving to a different store to hold that global state.

I'm going to mark this wontfix. I'll completely agree that it would be a good idea to remove the global state; however, this is really a small part of a much bigger architectural problem.

comment:3 Changed 17 months ago by kmtracey

  • Resolution wontfix deleted
  • Status changed from closed to reopened

This should more properly be closed as a dupe of #15894. Nobody there has yet objected that not everyone has a cache configured. This is so extremely broken in a multiprocess environment that it deserves fixing, in my opinion.

comment:4 Changed 17 months ago by kmtracey

  • Resolution set to duplicate
  • Status changed from reopened to closed

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.