Perfect ...

Thanks

On Tue, Oct 20, 2009 at 01:29, Mike Orr <[email protected]> wrote:
>
> 'g' is fine for semi-permanent caching, although the 'cache' object
> has built-in support for timeouts.
>
> Modifying 'g' attributes is fine as long as you do it in a thread-safe
> manner.  Build your data structure in a local variable, and then
> reassign the attribute in one step.
>
> I use 'g' + pickle for some non-database data.  It's a vocabulary list
> maintained by somebody else in HTML <dl> format.  At startup I look
> for the pickle in the data directory.  If it exists and is more recent
> than the source, I use it directly.  Otherwise I re-parse the file and
> update the pickle, and log a warning. My AppGlobals.__init__() looks
> like this:
>
>
>        self.glossary = get_glossary(
>            config["glossary.html_file"],
>            config["glossary.pickle_file"])
>
> You could also do the same in environment.py .
>
> --Mike
>
> On Mon, Oct 19, 2009 at 9:17 PM, Jonathan Vanasco <[email protected]> 
> wrote:
>>
>> i do this myself.  it saves me a bunch of database calls and
>> bottlenecks.
>>
>> i use a slightly different approach though:
>>
>> - i pickle the data as i assemble it
>> - i load stuff up on app initialization, and only hit the db the
>> pickled file is older than 10 minutes or doesn't exist ( it cuts down
>> development when "paster --reload" is used
>> - i set a timestamp for all my 'constants' , and have them refresh at
>> regular intervals.  this keeps me from needing to restart.
>>
>> i don't quite understand exactly how g works, but i was under the
>> impression that instructing it to reload manually may not work because
>> of threads.  so i stayed away from that.
>>
>>
>>
>> >
>>
>
>
>
> --
> Mike Orr <[email protected]>
>
> >
>



-- 
Atte.
Martín Marrese
--
JID: kyheo at lugmen.org.ar
MSN: martin at marrese.com.ar
GTalk: marrese at gmail.com
Skype: kyheo_ (with the _)
--
Hay quien esta vida se la toma a broma
y hay quien se suicida con balas de goma.
(F&F)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to