You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Kinetic Slam <ki...@gmail.com> on 2006/10/31 15:40:56 UTC

Preventing embperl caching of dynamic data?

Hello again.

If I'm understanding what I see correctly, I running into an issue where
Embperl is caching output I don't want cached.

I've been trying to get Embperl to stop caching my dynamic pages on my site
without success.  I'm just not properly understanding the use of
EMBPERL_EXPIRES_IN and/or EMBPERL_EXPIRES_FUNC I guess.

I'm using EMBPERL for templating and using embperl's subreq to run a perl
script which outputs a web form and dynamic data from a database.   (
testscript.html -> testscript.pl -> HTML output)

When I access the testscript.pl directly I can see the expected updated data
each time I refresh the browser (I just don't get my embperl template).

When I use testcript.html I can get the updated dynamic data sometimes
(especially after just restarting Apache) but normally see what appears to
be stale cached data.  When I see what I believe is Embperl cached data I
see the following two lines in my embperl_log file:

[27286]Use App: testapp
[27286]Using APACHE for output...

When I see updated dynamic data (what I want) I see something like:

[27286]Use App: testapp
[27289] Use Recipe Embperl

I've tried adding 'EMBPERL_EXPIRES_IN 0' and 'EMBPERL_EXPIRES_FUNC "sub
{1}"' in my httpd.conf file but these settings do not appear to be making a
difference.  I started working with these two variables after doing some
searching into disabling the embperl cache.

I'm running Embperl 2.2.0, mod_perl 2.0.2 under Apache 2.2.3.

Any help is appreciated.

-KineticSlam

Re: Preventing embperl caching of dynamic data?

Posted by Kinetic Slam <ki...@gmail.com>.
Well, I wasn't successfull getting around the caching of my perl script
output so I stopped trying to get my established perl scripts working under
Embperl with little to no changes.  I've converted one of them to a more
Embperl form and have now gotten around my caching problem.

I'm sure that's what I should have done a while ago.  I was just trying to
get Embperl templating with very little to no conversion work of my Apache2
registry scripts.

-KineticSlam

Re: Preventing embperl caching of dynamic data?

Posted by Kinetic Slam <ki...@gmail.com>.
OK, I turned up embperl debugging to include cache logging.  When I receive
updated output from testscript.html I see the following in my embperl_log
file:

==================================================================
[7934]CACHE: Created new CacheItem
*file:<PathEditedToProtectTheInnocent>/testscript.html; expires_in=0
expires_func=no
expires_filename=<PathEditedToProtectTheInnocent>/testscript.html cache=no
[7934]CACHE: Created new CacheItem
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl;
expires_in=0 expires_func=no expires_filename= cache=no
[7934]CACHE: Created new CacheItem
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl*epcompile:;
expires_in=0 expires_func=no expires_filename= cache=yes
[7934]CACHE: *file:<PathEditedToProtectTheInnocent>/testscript.html stat
file <PathEditedToProtectTheInnocent>/testscript.html mtime=1162300803
size=111
[7934]CACHE: *file:<PathEditedToProtectTheInnocent>/testscript.html expired
because file <PathEditedToProtectTheInnocent>/testscript.html changed
[7934]CACHE:
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl
expired because dependencies is expired or newer
[7934]CACHE:
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl*epcompile:
expired because dependencies is expired or newer
[7934]CACHE:
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl*epcompile:
get from provider
[7934]CACHE:
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl get
from provider
[7934]Reading <PathEditedToProtectTheInnocent>/testscript.html as input
using PerlIO (111 Bytes)...
[7934]CACHE: Update CacheItem
*file:<PathEditedToProtectTheInnocent>/testscript.html; expires_in=0
expires_func=no
expires_filename=<PathEditedToProtectTheInnocent>/testscript.html cache=no
[7934]CACHE: Update CacheItem
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl;
expires_in=0 expires_func=no expires_filename= cache=no
[7934]CACHE: Update CacheItem
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl*epcompile:;
expires_in=0 expires_func=no expires_filename= cache=yes
[7934]CACHE: Update CacheItem
*file:<PathEditedToProtectTheInnocent>/testscript.html; expires_in=0
expires_func=no
expires_filename=<PathEditedToProtectTheInnocent>/testscript.html cache=no
[7934]CACHE: Update CacheItem
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl;
expires_in=0 expires_func=no expires_filename= cache=no
[7934]CACHE: Update CacheItem
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl*epcompile:;
expires_in=0 expires_func=no expires_filename= cache=yes
[7934]CACHE: Created new CacheItem
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl*epcompile:*eprun:;
expires_in=0 expires_func=no expires_filename= cache=no
[7934]CACHE:
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl*epcompile:*eprun:
expired because dependencies is expired or newer
[7934]CACHE:
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl*epcompile:*eprun:
get from provider
[7934]CACHE:
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl take
from cache
[7934]CACHE: *file:<PathEditedToProtectTheInnocent>/testscript.html take
from cache
[7934]CACHE:
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl*epcompile:
get from provider
[7934]CACHE: Created new CacheItem *subreq:cgi-bin/testscript.pl;
expires_in=0 expires_func=no expires_filename= cache=no
[7934]CACHE: Created new CacheItem
*subreq:cgi-bin/testscript.pl*epparse:Embperl; expires_in=0 expires_func=no
expires_filename= cache=no
[7934]CACHE: Created new CacheItem
*subreq:cgi-bin/testscript.pl*epparse:Embperl*epcompile:; expires_in=0
expires_func=no expires_filename= cache=yes
[7934]CACHE: Created new CacheItem
*subreq:cgi-bin/testscript.pl*epparse:Embperl*epcompile:*eprun:;
expires_in=0 expires_func=no expires_filename= cache=no
[7934]CACHE: *subreq:cgi-bin/testscript.pl NOT expired
[7934]CACHE: *subreq:cgi-bin/testscript.pl*epparse:Embperl NOT expired
[7934]CACHE: *subreq:cgi-bin/testscript.pl*epparse:Embperl*epcompile: NOT
expired
[7934]CACHE: *subreq:cgi-bin/testscript.pl*epparse:Embperl*epcompile:*eprun:
NOT expired
[7934]CACHE: *subreq:cgi-bin/testscript.pl*epparse:Embperl*epcompile:*eprun:
get from provider
[7934]CACHE: *subreq:cgi-bin/testscript.pl*epparse:Embperl*epcompile: get
from provider
[7934]CACHE: *subreq:cgi-bin/testscript.pl*epparse:Embperl get from provider
==================================================================

I notice the "expired because dependencies is expired or newer" line above
which makes sense to me since this would be the first time embperl saw the
page after restarting Apache.

When I receive cached data with stale information I find the following:

==================================================================
[7934]CACHE: Free content for
*file:<PathEditedToProtectTheInnocent>/testscript.html
[7934]CACHE: Free content for
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl
[7934]CACHE: Free content for *subreq:cgi-bin/testscript.pl
[7934]CACHE: Free content for *subreq:cgi-bin/testscript.pl*epparse:Embperl
[7934]CACHE: Free content for
*subreq:cgi-bin/testscript.pl*epparse:Embperl*epcompile:*eprun:
[7934]CACHE: Free content for
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl*epcompile:*eprun:
[7934]CACHE: Update CacheItem
*file:<PathEditedToProtectTheInnocent>/testscript.html; expires_in=0
expires_func=no
expires_filename=<PathEditedToProtectTheInnocent>/testscript.html cache=no
[7934]CACHE: Update CacheItem
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl;
expires_in=0 expires_func=no expires_filename= cache=no
[7934]CACHE: Update CacheItem
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl*epcompile:;
expires_in=0 expires_func=no expires_filename= cache=yes
[7934]CACHE: Update CacheItem
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl*epcompile:*eprun:;
expires_in=0 expires_func=no expires_filename= cache=no
[7934]CACHE:
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl*epcompile:*eprun:
expired because provider C sub returned TRUE
[7934]CACHE:
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl*epcompile:*eprun:
get from provider
[7934]CACHE: *file:<PathEditedToProtectTheInnocent>/testscript.html stat
file <PathEditedToProtectTheInnocent>/testscript.html mtime=1162300803
size=111
[7934]CACHE: *file:<PathEditedToProtectTheInnocent>/testscript.html NOT
expired
[7934]CACHE:
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl NOT
expired
[7934]CACHE:
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl*epcompile:
NOT expired
[7934]CACHE:
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl take
from cache
[7934]CACHE: *file:<PathEditedToProtectTheInnocent>/testscript.html take
from cache
[7934]CACHE:
*file:<PathEditedToProtectTheInnocent>/testscript.html*epparse:Embperl*epcompile:
taken from cache
[7934]CACHE: Update CacheItem *subreq:cgi-bin/testscript.pl; expires_in=0
expires_func=no expires_filename= cache=no
[7934]CACHE: Update CacheItem *subreq:cgi-bin/testscript.pl*epparse:Embperl;
expires_in=0 expires_func=no expires_filename= cache=no
[7934]CACHE: Update CacheItem
*subreq:cgi-bin/testscript.pl*epparse:Embperl*epcompile:; expires_in=0
expires_func=no expires_filename= cache=yes
[7934]CACHE: Update CacheItem
*subreq:cgi-bin/testscript.pl*epparse:Embperl*epcompile:*eprun:;
expires_in=0 expires_func=no expires_filename= cache=no
[7934]CACHE: *subreq:cgi-bin/testscript.pl*epparse:Embperl*epcompile:*eprun:
expired because provider C sub returned TRUE
[7934]CACHE: *subreq:cgi-bin/testscript.pl*epparse:Embperl*epcompile:*eprun:
get from provider
[7934]CACHE: *subreq:cgi-bin/testscript.pl NOT expired
[7934]CACHE: *subreq:cgi-bin/testscript.pl*epparse:Embperl NOT expired
[7934]CACHE: *subreq:cgi-bin/testscript.pl*epparse:Embperl*epcompile: NOT
expired
[7934]CACHE: *subreq:cgi-bin/testscript.pl*epparse:Embperl take from cache
[7934]CACHE: *subreq:cgi-bin/testscript.pl take from cache
[7934]CACHE: *subreq:cgi-bin/testscript.pl*epparse:Embperl*epcompile: taken
from cache
==================================================================

Here I notice the "expired because provider C sub returned TRUE" which would
fall inline with my EMBPERL_EXPIRES_FUNC "sub {1}" in httpd.conf.  But I
then see "taken from cache" even though embperl did seem to notice the page
had been expired.

-KineticSlam

RE: Preventing embperl caching of dynamic data?

Posted by Gerald Richter <ri...@ecos.de>.
Hi,

> 
> If I'm understanding what I see correctly, I running into an 
> issue where Embperl is caching output I don't want cached.
> 
> I've been trying to get Embperl to stop caching my dynamic 
> pages on my site without success.  I'm just not properly 
> understanding the use of EMBPERL_EXPIRES_IN and/or 
> EMBPERL_EXPIRES_FUNC I guess.
> 

Embperl per default does not cache any output. You need EMBPERL_EXPIRES_IN
and EMBPERL_EXPIRES_FUNC only if want to cache the output.

> Well, I wasn't successfull getting around the caching of my 
> perl script output so I stopped trying to get my established 
> perl scripts working under Embperl with little to no changes. 
>  I've converted one of them to a more Embperl form and have 
> now gotten around my caching problem. 
>  
> I'm sure that's what I should have done a while ago.  I was 
> just trying to get Embperl templating with very little to no 
> conversion work of my Apache2 registry scripts.
>  

Embperl should be able to run registry scripts with little modification, but
it seems that you have done something that Embperl doesn't like.

So if you have still scripts you have trouble with, please send us a small
example that shows the behaviour

Gerald



 
** Virus checked by BB-5000 Mailfilter ** 


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