← Back to team overview

launchpad-dev team mailing list archive

Re: Using a signal to switch to read-only mode

 

On Sat, 2010-01-09 at 10:26 +0700, Stuart Bishop wrote:
> 
> On Fri, Jan 8, 2010 at 6:27 PM, Guilherme Salgado <salgado@xxxxxxxxxxxxx> wrote:
> 
> > We'll have a bunch of callsites for the utility
> > (DatabaseConfig.main_master/slave, model/pofile.py, webapp/adapter.py,
> > webapp/authorization.py, webapp/dbpolicy.py, and others), and nearly all
> > of them would benefit from a cache in the request, so I'd rather do it
> > in the utility.
> 
> If you are caching the request, you need to use a thread global. The reason you are caching the request is so you can access a request annotation. Why not just store your information in a thread global instead of a request annotation?
> 

I'm not caching the request itself -- I just want to cache the read-only
flag (when a request exists) so that we don't make more than one stat()
calls during a single request.

-- 
Guilherme Salgado <salgado@xxxxxxxxxxxxx>

Attachment: signature.asc
Description: This is a digitally signed message part


References