NYCPHP Meetup

[nycphp-talk] Caching only images

NYPHP xml at aumcomputers.com
Fri Apr 4 00:06:57 EST 2003


Hans,

your comment:

"If  user is using an ISP that uses caching, and you have proper caching
headers set on your pages, then it'll save you bandwidth"

Here seems some hope, then i would like to know what are those proper
"caching headers set" that i need to set in my php script. Consider below
example of function header. (page will be cached for for 1 day, including
all objects that reside in it)

header("Cache-Control: max-age=86400, must-revalidate");

Above function caches page on client or isp (for now forget where it
stores), BUT it stores whole document. While i need to store only IMAGES
that resides in this document. So do ineed to write above header in some
other way so that it will cache only images rather than docment? In short is
there any other arguments like
"Content-type: image/jpg" that i need to pass in above header functions so
that i can cache only images NOT document. I assume it is possible but i
just don't know how, nor i could find any example anywhere.

Thanks,

Anirudh Zala

----- Original Message -----
From: "David Rodriguez" <drodriguez1 at mac.com>
To: "NYPHP Talk" <talk at nyphp.org>
Sent: Thursday, 03 April, 2003 9:42 PM
Subject: Re: [nycphp-talk] Caching only images


> That is the kind of thing a service like Akamai does for you.  They
> store copies of whatever images or video you want on servers all over
> the world and when someone makes a request the data is drawn from the
> server closest to the requester.  Go to Akamai.com for more info.
> Otherwise I agree with Hans, you can't do it.
>
> D.
>
> On Thursday, Apr 3, 2003, at 10:51 America/New_York, Hans Zaunere wrote:
>
> >
> > This was the message that started the hailstorm, so I figure I'll jump
> > in and
> > test the waters :)
> >
> > --- NYPHP <info at aumcomputers.com> wrote:
> >> Hello Peeps,
> >>
> >> Is it possible to cache only images at my ISP? My exact situation is
> >> that
> >> my site has thousands of images, that I want to share among lot of
> >> users
> >> without loading it from server each time. I know i can use browser
> >> cache,
> >> but it can store whole documents including images but it works for 1
> >> client
> >> only and I don't want to cache whole document, but i just want to
> >> cache
> >> only images. Morover I prefer to cache images on my ISP server rather
> >> than
> >> relying on client's browser cache.
> >
> > Assuming I understand completly, the answer is no.
> >
> >> In short if user A request a page that laods from server then ISP
> >> should
> >> retain all images on it's cache and when user B request same page or
> >> a such
> >> page that contains same images, then images should be loaded from
> >> that ISP
> >> only not by loading it from my server so that I can save my valuable
> >> Bandwidth.
> >
> > No - you have no control over how other people access your site.  If
> > user is
> > using an ISP that uses caching, and you have proper caching headers
> > set on
> > your pages, then it'll save you bandwidth.  But you have no way of
> > enforcing
> > this.
> >
> > That said, there is a *slight* chance that you could work something
> > out with
> > *your* ISP, whereby they cache content for you, and for some insane
> > reason
> > would charge you less for the bandwidth used, but this is all highly
> > unlikely.
> >
> > H
> >
> >
> > =====
> > Hans Zaunere
> > President, New York PHP
> > http://nyphp.org
> > hans at nyphp.org
> >
> >
> >
> >
> >
>
>
>
> --- Unsubscribe at http://nyphp.org/list/ ---
>
>
>




More information about the talk mailing list