Log in

View Full Version : Caching Confusion



tacheman
07-05-2004, 02:31 PM
Hi,
I'm currently having difficulty in understanding Cacheing which I'm trying to implement in my AWS store. I'm using Cache Lite but think it will apply to any caching program. All the examples I have found use the following mechanism to cache pages:

<?php

require_once("Output.php");
$id = "MyStore";

$options = array( "cacheDir" => "cache/", "lifeTime" => 1800 );

$objCache = new Cache_Lite_Output($options);

if (!$objCache->start($id))
{
PAGE CONTENTS HERE

$objCache->end();
}

?>

My question is, do I use the same $id for the following urls?

www.mydom.com/shop/shop?category=music
www.mydom.com/shop/shop?category=film

Or would I use $id=music for one and $id=film for the other? When I use the same id (hard coded onto the page as above), I'm getting the same page as I browse through my shop so I expect that I need different id's. Having said that, all the examples I've seen use the same id (if this is the case then presumably the chaching program looks at the URL and keeps track of what page to serve for that id depending on the specified URL).

I'm most confused :confused: any ideas?

tomek
07-05-2004, 02:52 PM
instead of:

$id = "MyStore";

use:

$id = $HTTP_GET_VARS['category'];

AndyH
07-05-2004, 07:33 PM
or

$id = $_GET['category'];

:)

tacheman
07-06-2004, 09:47 AM
Thanks guys, I thought that I'd need different Id's but just wanted to check in case I was missing something.

Cheers,
Iain.