[Myghty-users] Manual cache expiry
Brought to you by:
zzzeek
From: Jens H. <jen...@gm...> - 2006-12-27 00:03:19
|
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 |