Hey,

I'm working on an includes output caching mechanism, based 
on the same dbm cache layer just released for the XSLTCache.
The functionality would allow for the output from an include
to be cached based on some optional key for a specified amount
of time.  So if an include might take 100ms to execute, and 
the cache only takes 5ms to fetch from, there could be
a 20x savings for that part of the script.

This caching layer would eventually extend to caching
whole scripts, and also to have a user level cache extension.

The includes caching API might look like:

  $Response->Include({ 
          File  => 'file.inc',
          Cache => 3600, # to cache one hour
          Key   => [\%data || \@data || \$data || $data || undef]
        },
        @args
        );

$Response->Include('file.inc', @args) would be also OK for an API
as it is now, the above is just an extension. 

The Cache argument would be the time in seconds to cache for.

The Key part would serialized & combined with the file name
to create a lookup for the cache... so if a header was dependent
on the user name in $Session for example, the key might be called 
like:

  Key => $Session->{user_id},

of if the include should change based on the query string data,
you might:

  Key => $Request->QueryString,

The functionality I have now would auto expire should the 
web server be restarted.  This can be useful as a web server 
restart is often associated with a full code publish, which
would usually be done at night off peak.  It seems like this 
could also be a httpd.conf config like 

  PerlSetVar CacheRestartPurge 1

But if it doesn't have to be created, then I won't create it.
Does it seem sensible to auto purge your cache every server
restart? 

-- Josh
_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks Founder                       Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to