Re: Solution for Caching and URL query string
| From: | Monte Ohrt | Date: | Mon, 30 Jul 2001 13:29:50 +0000 |
| Subject: | Re: Solution for Caching and URL query string | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1298@lists.php.net to get a copy of this message | ||
and-is Uwe Regenbogen wrote:
>
> Thank you Hans-Peter!
>
> but after having a close look to the fetch() function in smarty_class.php
> I'm using the cache_id which is an optional second parameter for this
> function. I'm simply creating a SCRIPT_URI plus QUERY_STRING plus
> HTTP_POST_VARS plus browser-name plus language (which defaults to the user's
> accepted language).
>
> After that it's easy:
>
> $smarty -> display ( "template_name" , "my_simple_cache_id" );
>
> the cache file is now unique by template_name, query-string, post-vars and
> browser.
ouch! You want to make a different cache file for each page _and_ each
user that visits your site? That is not a very efficient use of the
cache. The purpose of a cache is so it is reusable to multiple users,
yes? Or are you misusing the cache as some sort of session manager? ;-)
We frequently use the PATH_INFO as the cache id, then you can pass
parameters here specifically for cache handling, and QUERY_STRING does
not affect it.
http://www.domain.com/index.php/SECTION/SPORTS?foo=bar
In this case, "/SECTION/SPORTS" is my cache id.
Monte
>
> Hope this is usefull for someone.
>
> Uwe Regenbogen
>
> ----- Original Message -----
> From: Hans-Peter Oeri <ikkampfcaspar@oeri.ch>
> To: Uwe Regenbogen <uwe@and-is.de>
> Cc: <smarty@lists.ispi.net>
> Sent: Sunday, July 29, 2001 2:45 PM
> Subject: Re: [smarty] Caching and URL query string
>
> > Hi!
> >
> > Quoting and-is Uwe Regenbogen <uwe@and-is.de>:
> >
> > > Question:
> > > -is the URL's query string part of the caching logic?
> > > -are the HTTP_POST_VARS part of the caching logic?
> >
> > > I've tried it several times but as soon as I switch caching ON all the
> > > previous / next page links show me the results I've already seen.
> >
> > With that, you give the answer yourself. No, nothing besides a different
> > cache_id, a cache clear or a cache timeout interferes with caching.
> >
> > The notable difference are inserted templates that are never cached. That
> > means, you could simply "insert" the variable part of the page.
> >
> > Don't conform!
> > IkKampfCaspar75
> >
> >
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/