Re: Document Caching

2002-03-07 Thread Rafiq Ismail (ADMIN)

On Wed, 6 Mar 2002, Rasoul Hajikhani wrote:
 Robert Landrum wrote:
  #startup.pl
 
  open(FILE,/path/to/tmpl);
  $MY::TEMPLATE .= while(FILE);
  close(FILE);
 Thanks... But I use Template Toolkit to generate a dynamic file. How
 would the above code work in that situation?!
Not how I'd do it, although I'm pretty sure that TT2 has it's own caching
mechanism, however in answer to this 'particular question' could you not
overload TT's service object to use the preloaded instantiation similar,
or more specialised than the one above. (SEE ALSO man Template::Service
..probably) :)

fiq


btw Apache::Template does let you control caching of templates in memory.




Re: Document Caching

2002-03-07 Thread Perrin Harkins

Cahill, Earl wrote:
 I would not be opposed to calling a different,
 more standard function to check the cache (set up in a more standard way),
 and then fetch accordingly.

Look at how the Memoize module does it.  You may be able to do something 
similar that would allow caching to be added easilly to any pure virtual 
function.

- Perrin





Re: Document Caching

2002-03-06 Thread Robert Landrum

At 12:28 PM -0800 3/6/02, Rasoul Hajikhani wrote:
Hello People,
Need your advise on how to cache a template under mod_perl... Any ideas?
Thanks in advance
-r


#startup.pl

open(FILE,/path/to/tmpl);
$MY::TEMPLATE .= while(FILE);
close(FILE);


Provided that you never change $MY::TEMPLATE, this should work fine.


--
When I used a Mac, they laughed because I had no command prompt. When 
I used Linux, they laughed because I had no GUI.  



Re: Document Caching

2002-03-06 Thread Rasoul Hajikhani

Robert Landrum wrote:
 
 At 12:28 PM -0800 3/6/02, Rasoul Hajikhani wrote:
 Hello People,
 Need your advise on how to cache a template under mod_perl... Any ideas?
 Thanks in advance
 -r
 
 #startup.pl
 
 open(FILE,/path/to/tmpl);
 $MY::TEMPLATE .= while(FILE);
 close(FILE);
 
 Provided that you never change $MY::TEMPLATE, this should work fine.
 
 --
 When I used a Mac, they laughed because I had no command prompt. When
 I used Linux, they laughed because I had no GUI.
Thanks... But I use Template Toolkit to generate a dynamic file. How
would the above code work in that situation?!
-r



RE: Document Caching

2002-03-06 Thread Henigan, Timothy



Rasoul Hajikhani wrote:
 
 Robert Landrum wrote:
  
  At 12:28 PM -0800 3/6/02, Rasoul Hajikhani wrote:
  Hello People,
  Need your advise on how to cache a template under 
 mod_perl... Any ideas?
  Thanks in advance
  -r
  
  #startup.pl
  
  open(FILE,/path/to/tmpl);
  $MY::TEMPLATE .= while(FILE);
  close(FILE);
  
  Provided that you never change $MY::TEMPLATE, this should work fine.
  
  --
  When I used a Mac, they laughed because I had no command 
 prompt. When
  I used Linux, they laughed because I had no GUI.
 Thanks... But I use Template Toolkit to generate a dynamic file. How
 would the above code work in that situation?!
 -r
 

The Template Toolkit package includes it's own caching mechanism.  Check out
the pod for Template::Provider on your system.  I'm not sure how it works
under mod_perl, but it should be a good place for you to start.

Tim



RE: Document Caching

2002-03-06 Thread Henigan, Timothy



 Timothy Henigan wrote:
 At Wednesday, March 06, 2002 4:23 PM
 
 
 Rasoul Hajikhani wrote:
  
  Robert Landrum wrote:
   
   At 12:28 PM -0800 3/6/02, Rasoul Hajikhani wrote:
   Hello People,
   Need your advise on how to cache a template under 
  mod_perl... Any ideas?
   Thanks in advance
   -r
   
   #startup.pl
   
   open(FILE,/path/to/tmpl);
   $MY::TEMPLATE .= while(FILE);
   close(FILE);
   
   Provided that you never change $MY::TEMPLATE, this should 
 work fine.
   
   --
   When I used a Mac, they laughed because I had no command 
  prompt. When
   I used Linux, they laughed because I had no GUI.
  Thanks... But I use Template Toolkit to generate a dynamic file. How
  would the above code work in that situation?!
  -r
  
 
 The Template Toolkit package includes it's own caching 
 mechanism.  Check out
 the pod for Template::Provider on your system.  I'm not sure 
 how it works
 under mod_perl, but it should be a good place for you to start.
 
 Tim
 

Slashdot caches templates under mod_perl in their system.  For an example,
download the latest version of slashcode (2.2.5) and take a look at the
/slash/Slash/Display/Provider/Provider.pm module.

http://sf.net/project/showfiles.php?group_id=4421release_id=73958

Tim



RE: Document Caching

2002-03-06 Thread Cahill, Earl

I am finishing up a sort of alpha version of Data::Fallback (my own name)
which should work very well for cache'ing just about anything locally on a
box.  We  are planning on using it to cache dynamically generated html
templates and images.  You would ask a local perl daemon (using Net::Server)
for the info and it would look first in the cache.  If it isn't in the
cache, it falls back according to where you told it to look (for now
conffile or DBI, but later Storable, dbm, HTTP hit, whatever), and caches
how you tell it to, based on ttl if you like.

I am doing some testing now to see what sort of numbers we can get.  Looking
like 100-200 queries a second, but we'll see if that holds up in production,
under high loads.  I hope to write some docs on it over the weekend and get
at least some alpha version CPAN'd before too long here.

Earl

 -Original Message-
 From: Rasoul Hajikhani [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, March 06, 2002 1:28 PM
 To: [EMAIL PROTECTED]
 Subject: Document Caching
 
 
 Hello People,
 Need your advise on how to cache a template under mod_perl... 
 Any ideas?
 Thanks in advance
 -r
 



Re: Document Caching

2002-03-06 Thread Perrin Harkins

Cahill, Earl wrote:
 I am finishing up a sort of alpha version of Data::Fallback (my own name)
 which should work very well for cache'ing just about anything locally on a
 box.  We  are planning on using it to cache dynamically generated html
 templates and images.  You would ask a local perl daemon (using Net::Server)
 for the info and it would look first in the cache.  If it isn't in the
 cache, it falls back according to where you told it to look (for now
 conffile or DBI, but later Storable, dbm, HTTP hit, whatever), and caches
 how you tell it to, based on ttl if you like.

Hmmm... isn't that sort of backwards?  It sounds like you're considering 
  the problem as building a cache that can be taught how to fetch data, 
but to me it seems more natural to build components for fetching data 
and teach them how to cache.

The semantic for describing how something can be cached are much simpler 
than those describing how something can be fetched.  I would think it 
makes more sense to do something along the lines of the Memoize module, 
i.e. make it easy to add caching to your existing data fetching modules 
(hopefully using a standard interface like Cache::Cache).

- Perrin




RE: Document Caching

2002-03-06 Thread Cahill, Earl

 Hmmm... isn't that sort of backwards?  It sounds like you're 
 considering 
   the problem as building a cache that can be taught how to 
 fetch data, 
 but to me it seems more natural to build components for fetching data 
 and teach them how to cache.
 
 The semantic for describing how something can be cached are 
 much simpler 
 than those describing how something can be fetched.  I would think it 
 makes more sense to do something along the lines of the 
 Memoize module, 
 i.e. make it easy to add caching to your existing data 
 fetching modules 
 (hopefully using a standard interface like Cache::Cache).

Yeah, I buy that.  Mostly I have been writing the fetching routines, and in
sort of ad hoc fashion I have started to add on the caching stuff.  I am
just using a hash structure built on the modle File::CacheDir that I wrote.
For me it is a two part problem that is pretty easily divisible.  I have a
function that checks the cache and if it returns false, then I fetch it
according to the fallback.  I would not be opposed to calling a different,
more standard function to check the cache (set up in a more standard way),
and then fetch accordingly.

Earl



Re: Document Caching

2002-03-06 Thread Adekunle Olonoh


  Need your advise on how to cache a template under mod_perl... Any ideas?
  Thanks in advance
  
 Thanks... But I use Template Toolkit to generate a dynamic file. How
 would the above code work in that situation?!

You should probably post this to the Template Toolkit mailing list for
more info but TT has built-in support for caching templates to disk.

TT mailing list: http://www.template-toolkit.org/info.html#lists
TT caching:
http://www.template-toolkit.org/docs/plain/Manual/Config.html#Caching_and_Compiling_Options


--Ade.


_
Do You Yahoo!?
Get your free yahoo.com address at http://mail.yahoo.com