Author |
Message |
Grim...
|
|
Post subject: Apache and Caching Posted: Tue Jul 20, 2010 17:11 |
|
SupaMod |
|
Est. 1978 |
Joined: 27th Mar, 2008 Posts: 69724 Location: Your Mum
|
Hi. I've not done any research into this because I'm a lazy bastard busy, but imagine this scenario:
User uploads image. Web service takes image, and gives user a url which will eventually hold his image. In the meantime, web service puts a placeholder image in the location the url points to. x amount of time goes by, and the image the user uploaded is messed about with with. Finally, the placeholder image is overwritten by the uploaded and reprocessed image.
So, I want the server to tell any clients to cache the image (pretty much) forever, but only once it has been reprocessed, otherwise it shouldn't cache it at all. Anything before that and it'll just be caching the placeholder, which will have the same filename.
Going from what I remember from the top of my head this is possible if I put each image into its own folder and copied a .htaccess file in with them (saying "don't cache me"), and replaced said .htaccess file (with one that says "cache me hard, big boy") once the image was done.
Is it doable without putting everything into its own folder?
_________________
Grim... wrote: I wish Craster had left some girls for the rest of us.
|
|
Top |
|
|
Doctor Glyndwr
|
Post subject: Re: Apache and Caching Posted: Tue Jul 20, 2010 17:18 |
|
Joined: 30th Mar, 2008 Posts: 32624
|
Serve the images from a PHP script and send an ETAG header. Although Apache might actually handle that anyway for JPGs on the disk.
|
|
Top |
|
|
Grim...
|
Post subject: Re: Apache and Caching Posted: Tue Jul 20, 2010 17:20 |
|
SupaMod |
|
Est. 1978 |
Joined: 27th Mar, 2008 Posts: 69724 Location: Your Mum
|
Could do, but using PHP involves extra workload every time an image is called. Shit's going to be busy, yo.
_________________
Grim... wrote: I wish Craster had left some girls for the rest of us.
|
|
Top |
|
|
Grim...
|
Post subject: Re: Apache and Caching Posted: Tue Jul 20, 2010 17:21 |
|
SupaMod |
|
Est. 1978 |
Joined: 27th Mar, 2008 Posts: 69724 Location: Your Mum
|
Oh, and the other little issue was "images" was a substitute for "files".
_________________
Grim... wrote: I wish Craster had left some girls for the rest of us.
|
|
Top |
|
|