Hi,

I've started doing a little bit of benchmarking for J�rg, but in the process I noticed that a couple of things slipped past me in my initial patches. The main one is that I put some of the required changes for the main patch into one of the optional ones (there are some required changes in XSP.pm for the new Cache.pm API). The other problem was that I added some assertion checks to warn when a cache object was constructed whilst caching should be disabled - but I forgot to disable caching in those situations!

Anyway, I've created a new patch:

        http://www.leishman.org/axkit_patches/axkit-incr-cache-2.patch
        MD5Sum: 511123e2b4a23cf683a8bb852b509628

I've also updated the previously 'untested' patch against XSP.pm. I've now actually tested it works - although it still doesn't do anything fancy with the new caching options:

        http://www.leishman.org/axkit_patches/axkit-xsp-newapi-2.patch
        MD5Sum: 54c6c984b405f32115de2b1970918700


I'm also curious - it seems that the implementation of XSP.pm attempts to cache the result of the XSP processing (the output from the generated perl module). Yet I thought that the results couldn't be cached/shouldn't be cached, since they are dynamic. Also, why isn't the compiled XSP (the perl module) written to a cache file? Currently it's only cached in memory.

A diff of the new changes introduced in the main patch is below.

Regards,
Chris

diff -ur xml-axkit.orig/lib/AxKit.pm xml-axkit/lib/AxKit.pm
--- xml-axkit.orig/lib/AxKit.pm Tue Mar 25 20:59:47 2003
+++ xml-axkit/lib/AxKit.pm      Tue Mar 25 18:26:03 2003
@@ -379,8 +379,14 @@
         }
     }

+ # Don't try caching if it's disabled
+ if ($AxKit::Cfg->NoCache()) {
+ AxKit::Debug(5, "Caching disabled");
+ undef $cachekey;
+ }
+
# Don't cache POST responses
- if ($r->method() eq 'POST') {
+ if ($cachekey and $r->method() eq 'POST') {
AxKit::Debug(2, "Not caching POST request");
undef $cachekey;
}
diff -ur xml-axkit.orig/lib/Apache/AxKit/Language/XSP.pm xml-axkit/lib/Apache/AxKit/Language/XSP.pm
--- xml-axkit.orig/lib/Apache/AxKit/Language/XSP.pm Tue Mar 18 17:18:20 2003
+++ xml-axkit/lib/Apache/AxKit/Language/XSP.pm Tue Mar 25 20:06:20 2003
@@ -36,7 +36,7 @@

 sub handler {
     my $class = shift;
-    my ($r, $xml, undef, $last_in_chain) = @_;
+    my ($r, $xml, undef, $last_in_chain, $cachekey) = @_;

_register_me_and_others();

@@ -161,13 +161,16 @@

$r->no_cache(1);

- my $xsp_cache = Apache::AxKit::Cache->new($r, $package, $package->cache_params($r, $cgi));
-
- if (!$package->has_changed($xsp_cache->mtime()) &&
- !$xml->has_changed($xsp_cache->mtime())) {
- AxKit::Debug(3, "XSP results cached");
- $r->print($xsp_cache->read);
- return;
+ my $xsp_cache;
+ if ($cachekey) {
+ $xsp_cache = Apache::AxKit::Cache->new($r, $package, $package->cache_params($r, $cgi));
+
+ if (!$package->has_changed($xsp_cache->mtime()) &&
+ !$xml->has_changed($xsp_cache->mtime())) {
+ AxKit::Debug(3, "XSP results cached");
+ $r->print(${$xsp_cache->xml_strref()});
+ return;
+ }
}

     my $dom = XML::LibXML::Document->createDocument("1.0", "UTF-8");
@@ -186,7 +189,7 @@
     $r->pnotes('dom_tree', $dom);
     $r->print($dom->toString) if $last_in_chain;

-    $xsp_cache->write( $dom->toString );
+    $xsp_cache->store( $dom->toString ) if $xsp_cache;
     return $rc;
 }


Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to