The new Beaker release looks great, Ben.
Can I plead for a couple of gratuitous examples to be added to Kai
perhaps? And maybe some tests using the cache decorators?
I haven't been able to persuade @cache.region to do any caching.
I'm using it like this with a Pylons controller:
def get_region(self, region_id):
@cache.region('long_term', 'foobar')
def foobar(region_id)
... stuff, returning a rendered mako tmpl
return foobar(region_id)
and with this in the .ini:
cache_dir = %(here)s/data/cache
beaker.cache.regions = long_term
beaker.cache.long_term.type = file
beaker.cache.long_term.expire = 86400
beaker.cache.data_dir = %(here)s/data/cache
What am I missing?
The above controller code works fine with the @cache.cache decorator:
@cache.cache('foobar', type='file', data_dir='./data/cache',
expire=86000)
The "data_dir" kwarg is required, the decorator throws an exception if
it's omitted:
MissingCacheParameter: data_dir or file_dir is required
(What's the difference between data_dir and file_dir?)
My middleware.py has (as per usual):
app = CacheMiddleware(app, config)
Shouldn't that be picking up the .ini directives?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---