Re: [Moin-devel] dependencies[] for macros
Jim Clark <[email protected]> Wed, 20 Apr 2005 15:14:01 +0200
| Newsgroups | gmane.comp.web.wiki.moin.devel |
|---|---|
| Message-ID | <[email protected]> |
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 =3D ["time"]
This forces a recalculation with each call of the macro.
2. Inside the macro call do this:
from MoinMoin import caching, wikiutil
cache =3D 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 in=
fo,
new features, or free trial, at: http://www.businessobjects.com/devxi/728