On Mon, 13 Sep 2004, Davis, Sean (NIH/NHGRI) wrote:

> I only need a subset (on the order of 10's or 100's of images) for each
> script invocation, but what I have doesn't work, so I will probably just
> precompute and pull them up as needed.

I realize that this is awfully hand-wavey, but I've seen systems that 
handle situations like this by first attempting to use a pre-computed 
image (or whatever storable expensive-to-compute-thing is relevant)  
and if one isn't available, then making one, saving it, then serving 
both now and in the future. This makes the first hit slow, but future 
ones fast, which is often reasonable. 

As rough pseudocode, this would be something like the below:

  my $CGI = new CGI;
  my $stash_img = munge_params_into_filename( $CGI );
  my $image     = check_for_existance( $stash_img ) or
                  generate_and_stash( $stash_img, $CGI );
  serve_image( $image );
  exit 0;

Fleshing out these subroutines is an exercise for the reader :-)



-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to