This is probably because the arguments to the method change every time the
method is called. i.e. "self" is a different instance of your class every
time.

On Mon, Nov 14, 2011 at 1:49 PM, Jason <ja...@deadtreepages.com> wrote:

> Whenever  I call a method decorated with cache_region it is still
> executing the method every time it is called (as I see with a print
> statement while in development).
>
> I have my beaker config in the INI file:
>
> cache.regions = default_term, second, short_term, long_term
> cache.type = memory
> cache.second.expire = 1
> cache.short_term.expire = 60
> cache.default_term.expire = 300
> cache.long_term.expire = 3600
>
> Which get configured as regions in main():
>
> pyramid_beaker.set_cache_regions_from_settings(settings)
>
> In the handler (I'm using pyramid_handlers) I have imported "from
> beaker.cache import cache_region" and then used the decorator as:
>
> @cache_region('default_term', 'contacts')
> def _get_contacts(self, userid):
>     print 'retrieving contacts'
>     # get contacts from another server
>     return contacts
>
> This is being called from a view-callable.
>
> Is there something simple I am overlooking, this is all the setup that I
> have seen required in the pyramid_beaker and beaker documentation.
>
>
> Thanks,
> Jason
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/pylons-discuss/-/wbJZX5hgbFQJ.
> To post to this group, send email to pylons-discuss@googlegroups.com.
> To unsubscribe from this group, send email to
> pylons-discuss+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pylons-discuss?hl=en.
>



-- 

Michael

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

Reply via email to