Hi everyone,

I'm trying to create some lazy querying classes in my code to minimize
the number of queries run per request.  Suppose, for example, I wanted
to store all the comments on a site in a variable, cached_comments,
which is part of an application, Blog.  (Note, I'm not actually doing
anything this silly, but my work is confidential so this serves as an
illustrative but silly example.)

So Blog.cached_comments is lazy and will only run a query to get the
data if (a) it hasn't run the query yet, (b) something tries to access
it.  If someone adds a new comment, a function,
Blog.cached_comments.reset() is called which will set the state of
cached_comments to 'query not run yet.'

However, I'm a little confused, as it seems like as Apache runs
multiple processes, there could be multiple copies of
Blog.cached_comments floating around, each with differing data.  Is
this correct?  I know this is more of a mod_python question, but I
thought I'd ask it here as I'm not able to find the information I'm
looking for and it seems like django might be using some similar
structures to determine what fields in a form are changed.  Any help
or readings that could be suggested would be greatly appreciated.

Thanks,
Dan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to