Matt Sergeant, developer of AxKit, has already got plans to change the caching in order to include documents with different query strings in the cache. As for version 1.2, this kind of caching has to be implemented by yourself. The following paragraphs describe, how. It is a hack, though. It doesn't touch the sources, but instead changes the files in the Perl tree (sorry about this). A word of caution: especially, since Matt Sergeant will do the same thing done here much better and more consistently, use this code only, if you really need it - and if you know Perl, of course. Naturally this comes without any warranty ...
Once you have built AxKit, there will be a file AxKit.pm in your Perl tree; something like /usr/lib/perl5/siteperl/5.006/i386-linux on my Linux machine. Additionally, there is the directory /usr/lib/perl5/siteperl/5.006/i386-linux/Apache/AxKit with sub-directories like Language. First, you have to add one line to flat_params:
# in AxKit.pm
my @flat_params = qw(
Caching
# rest of the flat_params
);This new parameter (Caching in this case) will be used in two more files: Cache.pm and ConfigReader.pm. In Cache.pm you deal with the value of $no_cache and get it from httpd.conf
# in Cache.pm
# extract $no_cache from httpd.conf
#
my $no_cache = $AxKit::Cfg->Caching();
#
# we don't work with cachedirs in every other dir :-)
# hb, 25/1/2001
#
# if (!-e $cachedir) {
# if (!mkdir($cachedir, 0777)) {
# warn "Can't create cache directory '$cachedir': $!\n";
# $no_cache = 1;
# }
# }
#
# modified until here
#
my $self = bless {
# ...A sub-routine named like the paramater mentioned above should be included in ConfigReader.pm. And a few lines will have to be commented out...
# in ConfigReader.pm:
# decides whether to cache or not to cache
# hb 24/1/2001
sub Caching {
my $self = shift;
unless ($self->{cfg}{Caching} ||
$self->{apache}->dir_config('AxNoCaching')) {
return;
}
}
# a bit further down :-)
#
# commented out because .xmlstyle_cache not needed/used
# hb, 25/1/2001
#
# use File::Basename;
# my $dir = dirname($self->{apache}->filename());
# return $dir . "/.xmlstyle_cache";
}
Finally, you'll have to set a variable in your httpd.conf, in order to use the cache - or not:
<Location /home/hb/xslt/dict>SetHandler perl-script PerlHandler AxKit PerlSetVar AxNoCaching 1 ...</Location>
Dieser Text ist der Zeitschriften-Ausgabe 03/2001 von iX entnommen.
iOS, Android, Windows Phone 7 und HTML5 - das neue Sonderheft von heise Developer führt Einsteiger und Profis in die Programmierung mobiler Geräte ein.