Apache-ASP
view release on metacpan or search on metacpan
site/config.html view on Meta::CPAN
<font face="courier new" size=3><pre>
PerlSetVar XSLTCache 1
</pre></font>
<p>
<a name=XSLTCacheSiz6e7d9101></a>
<font face=verdana><font class=title size=-1 color=#555555><b>XSLTCacheSize</b></font>
<font face="courier new" size=3><pre>
</pre></font>as of version 2.11, this config is no longer supported.</font>
<p>
<a name=Caching></a>
<font face=verdana><font class=title size=+0 color=#555555><b>Caching</b></font>
<font face="courier new" size=3><pre>
</pre></font>The output caching layer is a file dbm based output cache that runs
on top of the MLDBM::Sync so inherits its performance characteristics.
With CacheDB set to MLDBM::Sync::SDBM_File, the cache layer is
very fast at caching entries up to 20K in size, but for greater
cached items, you should set CacheDB to another dbm like DB_File
or GDBM_File.
<font face="courier new" size=3><pre>
</pre></font>In order for the cache layer
to function properly, whether for $Response->Include() output
caching, see <a href=objects.html><font size=-1 face=verdana><b>OBJECTS</b></font></a>, or XSLT caching, see <a href=xml.html><font size=-1 face=verdana><b>XML/XSLT</b></font></a>, then
Apache::ASP must be loaded in the parent httpd like so:
<font face="courier new" size=3><pre>
# httpd.conf
PerlModule Apache::ASP
-- or --
<Perl>
use Apache::ASP;
</Perl>
</pre></font>The cache layer automatically expires entries upon
server restart, but for this to work, a $ServerID
must be computed when the Apache::ASP module gets
loaded to store in each cached item. Without the
above done, each child httpd process will get its
own $ServerID, so caching will not work at all.
<font face="courier new" size=3><pre>
</pre></font>This said, output caching will not work in raw <a href=cgi.html><font size=-1 face=verdana><b>CGI</b></font></a> mode,
just running under <a href=http://perl.apache.org><font size=-1 face=verdana><b>mod_perl</b></font></a>.</font>
<p>
<a name=CacheDB></a>
<font face=verdana><font class=title size=-1 color=#555555><b>CacheDB</b></font>
<font face="courier new" size=3><pre>
</pre></font>Like StateDB, sets dbm format for caching. Since SDBM_File
only support key/values pairs of around 1K max in length,
the default for this is MLDBM::Sync::SDBM_File, which is very
fast for < 20K output sizes. For caching larger data than 20K,
DB_File or GDBM_File are probably better to use.
<font face="courier new" size=3><pre>
PerlSetVar CacheDB MLDBM::Sync::SDBM_File
</pre></font>Here are some benchmarks about the CacheDB when used
with caching output from $Response->Include(\%cache)
running on a Linux 2.2.14 dual PIII-450.
The variables are output size being cached & the CacheDB used,
the default being MLDBM::Sync::SDBM_File.
<font face="courier new" size=3><pre>
</pre></font><table class="noescape" border="0">
<tr><th>CacheDB</th><th>Output Cached</th><th>Operation</th><th>Ops/sec</th></tr>
<tr><td>MLDBM::Sync::SDBM_File</td> <td>3200 bytes</td> <td>read</td> <td>177</td></tr>
<tr><td>DB_File</td> <td>3200 bytes</td> <td>read</td> <td>59</td></tr>
<tr><td>MLDBM::Sync::SDBM_File</td> <td>32000 bytes</td> <td>read</td> <td>42</td></tr>
<tr><td>DB_File</td> <td>32000 bytes</td> <td>read</td> <td>53</td></tr>
<tr><td>MLDBM::Sync::SDBM_File</td> <td>3200 bytes</td> <td>write</td> <td>42</td></tr>
<tr><td>DB_File</td> <td>3200 bytes</td> <td>write</td> <td>39</td></tr>
</table>
<font face="courier new" size=3><pre>
</pre></font>For your own benchmarks to test the relative speeds of the
various DBMs under MLDBM::Sync, which is used by CacheDB,
you may run the ./bench/bench_sync.pl script from the
MLDBM::Sync distribution on your system.</font>
<p>
<a name=CacheDir></a>
<font face=verdana><font class=title size=-1 color=#555555><b>CacheDir</b></font>
<font face="courier new" size=3><pre>
</pre></font>By default, the cache directory is at StateDir/cache,
but CacheDir can be used to set the StateDir value for
caching purposes. One may want the CacheDir separate
from StateDir for example StateDir might be a centrally
network mounted file system, while CacheDir might be
a local file cache.
<font face="courier new" size=3><pre>
PerlSetVar CacheDir /tmp/asp_demo
</pre></font>On a system like Solaris where there is a RAM disk
mounted on the system like /tmp, I could put the CacheDir
there. On a system like Linux where files are cached
pretty well by default, this is less important.</font>
<p>
<a name=CacheSize></a>
<font face=verdana><font class=title size=-1 color=#555555><b>CacheSize</b></font>
<font face="courier new" size=3><pre>
</pre></font>By default, this is 10M of data per cache. When any cache,
like the XSLTCache, reaches this limit, the cache will be purged
by deleting the cached dbm files entirely. This is better for
long term running of dbms than deleting individual records,
because dbm formats will often degrade in performance with
lots of insert & deletes.
<font face="courier new" size=3><pre>
</pre></font>Units of M, K, and B are supported for megabytes, kilobytes, and bytes,
with the default unit being B, so the following configs all mean the
same thing;
<font face="courier new" size=3><pre>
PerlSetVar CacheSize 10M
PerlSetVar CacheSize 10240K
PerlSetVar CacheSize 10485760B
PerlSetVar CacheSize 10485760
</pre></font>There are 2 caches currently, the XSLTCache, and the
Response cache, the latter which is currently invoked
for caching output from includes with special syntax.
See $Response->Include() for more info on the Response cache.</font>
<p>
<a name=Miscellaneou387baf01></a>
<font face=verdana><font class=title size=+0 color=#555555><b>Miscellaneous</b></font>
</font>
( run in 0.505 second using v1.01-cache-2.11-cpan-39bf76dae61 )