Hi all,

I'm working on a Pylons 0.9.7 application that does a lot of Web 2.0
stuff with AJAX/JSON data going back and forth through controller
methods. Because of our db schema there is a lot of Sqlalchemy calls
in our model, and many of them take quite a long time to run. I'd like
to cache this data as it's used on various parts of multiple pages,
and I've written a class that wraps beaker_cache, but I have a couple
questions.

1)   I''d like the cache to expire after X number of minutes, this is
no problem using beaker_cache, but I'd also like to invalidate the
cache if the underlying data is modified by an AJAX/JSON call, say
from a browser form action. I've seen that beaker_cache has an
invalidate method, but I'm not sure how best to use it and still get
effective use out of the cache. Any recommendations?

2)   I'm running my Pylons application under uwsgi, so there will be
multiple "processes" that are answering requests from multiple users.
If multiple users are looking at the same pages, I'd like to feed
those pages with the same cached data. What's a good way to handle
this? Should the cache be stored in the "dbm" backend so it's
available to all processes? Any other hints?

3)   In the beaker_cache invalidate method there is a "key" parameter
that is used (I think) to uniquely identify the cache item. What's a
good way to generate this key? In my class I'm trying to generate a
key based on the function name and the parameters it's passed so that
calls to the same function, but with different parameters (model
calls), will get cached as separate items. Is this a good idea, and if
so, am I going about it in an intelligent way?

Thanks in advance!
Doug

-- 
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