Didip,

Thanks for your reply, very helpful. I have been looking at the
cache_key method (something like what you're doing here), but I wasn't
sure how to get the granular control I'm looking for. For instance a
database function can be called multiple times with different
parameters to return different datasets. I would like to invalidate
each individual function call based on not only its signature, but the
parameters passed to it. If you can, take a look at the general reply
I'm going to make at the current end of this thread.

Thanks again!
Doug

On Jul 8, 8:31 pm, Didip Kerabat <[email protected]> wrote:
> Hi Doug,
>
> 1) I'm not quite sure about the question, but your session is also backed by
> beaker. By default the backend of session is filesystem.
>
> 2) Expiring @beaker_cache explicitly is a little tricky.
> You'll need several things:
>
> from pylons import cache, request
>
> from pylons.decorators.cache import create_cache_key
>
> See below example:
>
> key_dict = request.GET.mixed()
> namespace, key =
> create_cache_key(YourControllerClass.controller_method, key_dict)
> cache.get_cache(namespace).remove(key)
>
> 3) Most people I know, including me does it in the controller layer. I think
> it's the most explicit way of doing it.
>
> 4) It depends on how you structure the cache keys.
>
> 5) You can define multiple cache regions for different type of users. Below
> is example on how you can configure it:
>
> beaker.cache.regions = model
> beaker.cache.model.type = ext:memcached
> beaker.cache.model.url = 127.0.0.1:11211
>
> Don't worry about asking questions here, besides:
>
> "There are only two hard problems in Computer Science:
>    cache invalidation and naming things."
>
>    -- Phil Karlton
>
> Cheers,
> Didip Kerabat
>
>
>
> On Wed, Jul 7, 2010 at 1:35 PM, writeson <[email protected]> wrote:
> > Hi all,
>
> > I'm building Intranet Pylons applications at work and need some help
> > understanding caching. I'm confused by the different caching systems
> > and when to use them. Here are some questions that come to mind when
> > thinking about these things:
>
> > 1)  When should I use the session cache over the beaker cache, and
> > vice versa?
> > 2)  I have used the @beaker_cache decorator, but other than providing
> > a timeout, how else is invalidating the cache handled?
> > 3)  In regards to the question above, what is a good way to cache
> > expensive database queries, and invalidate them when the underlying
> > data changes?
> > 4)  Does a cached object span multiple users?
> > 5)  In regards to the above question, does the underlying caching
> > mechanism (file, memory, db, memcached) control whether a cached
> > object is available to multiple users?
>
> > I know, I know, I have a lot of questions about caching, I guess the
> > documentation I've read, and been pointed to before, hasn't helped me
> > understand how to use it or best practices.
>
> > 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]<pylons-discuss%2bunsubscr...@go 
> > oglegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/pylons-discuss?hl=en.

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