Re: [Myghty-users] Manual cache expiry
Brought to you by:
zzzeek
From: Michael B. <mi...@my...> - 2006-12-27 03:10:01
|
you should be able to call clear() on the cache instance returned by m.get_cache() within the template, as well as remove_value(key). im not sure why get_container() screws it up but the API of cache.py is a little antiquated at this point (im working on replacements for all of this stuff, more on that soon). id also suggest asking on the pylons-discuss list since those guys use the cache API a lot. On Dec 26, 2006, at 7:03 PM, Jens Hoffrichter wrote: > Hello everyone, > > At first I want to thank every contributer to the great work which is > delivered with Myghty, it's so much fun to work with it, it is so > simple and yet powerful! Keep on rockin' :) > > But with my current work a problem aroused I'm not able to solve > myself, and neither the documentation nor the web nor the source code > is much help to me. > > I have the following situation: > > I'm using Myghty 1.1 with Python 2.4.4, apache 2.3.3 with > mod_python 3.2.10 > > I have XML documents in a database and transform them via XSL to HTML. > The XML documents are seldom updated, so caching of the transformation > results would be fine, and as the documents are not accessed that > often (but there are lots of them ;) ), a long cache time would be > fine, too. > > So I keep track of the modification time of the docs via a SQL > trigger, and want to expire the cache manually if the documents > change, so they are regenerated using the XSL. I don't want to wait > for an automatic cache expiry, as I plan to set the expiry time to a > day or so, and I want to have the changes in the docs reflected to the > website in a very short timeframe. > > So I took a look at the caching api, saw that accessing the container > would be the right thing to do, compare the db timestamp against > .storedtime, and in a case of an updated doc I would call > .clear_value() to have the page rebuilded. > > But as soon as I access the cache after creating a reference to the > container with cache.get_container(key), there is always thrown a > KeyError, regardless what I do with the container, the call of > .get_container() is enough to "corrupt" the whole cache and getting > template errors. And I don't see the reason for this in the source > code :) > > What can I do to overcome this obstacle? How should I access the > cache? The caching api itsself is not enough (yet) to allow access to > the stored times etc., so currently I have to stick to the container, > I think. > > Thanks in advance for any advices! > > Regards, > Jens > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Myghty-users mailing list > Myg...@li... > https://lists.sourceforge.net/lists/listinfo/myghty-users |