On 17/06/2005, at 9:26, Kjetil Kjernsmo wrote:
On onsdag 15 juni 2005, 05:50, Scott Penrose wrote:For some reason, even if checking for the cached version, the sub get_strref is called. This means it is called twice on a normal request and once on a cached request. One particular module is fairly slow at converts and I need it to work properly on the caching side.Yup, this bit me too.... Well, I think the thing is that AxKit runs theProvider once to get the stylesheet information, for the upcoming transformation, and then run it again to create the content. It's a little quirk, and I think it is fixed in current CVS if you're interested.What I've done is that if I create a DOM, in get_dom, I store the dom in$self->{dom), and just check it on second pass, or similarly in get_strref, assign the output string to $self->{out} or something likethat. In the start of the get_strref, I then check if it exists, and ifit does, I return it just like that... :-)
Excellent. So the Provider is only created once, but then called twice. That is handy. Just checking though, the Provider will be destroyed after the request? ie: we are not going to have the string hanging around?
I am also looking at Provider::DOM to make it more efficient. I had based my code on Provider::HTML but that returns a string which then has to be parsed again by LibXML.
Thanks Scott
PGP.sig
Description: This is a digitally signed message part