perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carl Eklof <carlek...@yahoo.com>
Subject Using EmbPerl's Caching Functionality
Date Mon, 19 Dec 2005 22:14:15 GMT
As part of my performance tuning, I thought I'd also give the new caching functionality a whirl.
I did get it to work, and when it did, it worked very well (thanks Gerald). BTW, I found some
posts from people that want the cache to be disk-backed, but I MUCH prefer it to be in memory,
as being disk-backed would produce much worse performance that dynamically generating pages
for me, especially under high-load.
 
 I did encounter a couple problems, one of them is still preventing me from using the caching.
1) I couldn't get EMBPERL_CACHE_KEY_FUNC, or EMBPERL_EXPIRES_FUNC to work in my httpd.conf
(and I do have Embperl_UseEnv on) Trying to set either one would cause Apache to seg fault.

 
 Setting 
 
 EMBPERL_CACHE_KEY_FUNC "sub {$ENV{REQUEST_URI}}"
 or
 EMBPERL_EXPIRES_FUNC "sub {1}"
 
 ...and making a request would cause the following in the error_log:
 
 [Mon Dec 19 16:38:23 2005] [notice] child pid 9518 exit signal Segmentation fault (11)
 
 2) I got the EMBPERL_EXPIRES_FUNC functionality to work by specifying and EXPIRES sub in
my base.epl. As in:
 
 [!
 sub EXPIRES {
     <decide to return 0 or 1>
 
}
 !]
 
 However, I couldn't get the documented &CACHE_KEY sub to get invoked. I tested by putting
a print to STDERR, which never printed anything. This prevents me, and probably others from
using the caching because EmbPerl's default computation of a cache key doesn't seem to make
a distinction between:
 - http://coolhost.com/foobar
 and
 - http://coolhost.com/helloworld
 
 ...which is a very important distinction on my site, thus I would get the /foobar page, when
making a request for /helloworld, or vice versa.
 
 Does anybody have any working sample of the EMBPERL_CACHE_KEY_FUNC?
 
 Happy Holidays,
 
 -Carl
 
 





---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message