[Moin-devel] Re: [Moin-devel] dependencies[] for macros
Jim Clark
jim at clarkster.co.uk
Wed Apr 20 06:16:42 EDT 2005
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
More information about the Moin-devel
mailing list