Jim Clark
2005-04-20 13:14:01 UTC
Just an update on my caching question - I think I've found the answer,
but would be curious if there are alternative/better methods.
1. In the macro header, use the line
Dependencies = ["time"]
This forces a recalculation with each call of the macro.
2. Inside the macro call do this:
from MoinMoin import caching, wikiutil
cache = caching.CacheEntry(self.macro.request, 'RSS',
wikiutil.quoteWikinameFS(self.args['url']))
# if cached entry is from within the last hour, use it.
if (time.time() - cache.mtime() < 3600):
return cache.content()
#else, do feed parsing, generate HTML ...
cache.update(html)
Cheers,
Jim
-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728
but would be curious if there are alternative/better methods.
1. In the macro header, use the line
Dependencies = ["time"]
This forces a recalculation with each call of the macro.
2. Inside the macro call do this:
from MoinMoin import caching, wikiutil
cache = caching.CacheEntry(self.macro.request, 'RSS',
wikiutil.quoteWikinameFS(self.args['url']))
# if cached entry is from within the last hour, use it.
if (time.time() - cache.mtime() < 3600):
return cache.content()
#else, do feed parsing, generate HTML ...
cache.update(html)
Cheers,
Jim
-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728