Re: [SMARTY] Use of multiple caches per page.
| From: | Mark Rogers | Date: | Thu, 04 May 2006 14:41:24 +0000 |
| Subject: | Re: [SMARTY] Use of multiple caches per page. | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-13419@lists.php.net to get a copy of this message | ||
boots wrote:
> --- "Tony K." <tony.kruse@gmail.com> wrote:
>
>> I want to be able to cache various pages, all called index.php but
>> have various GET parameters for example like...
>>
>> index.php?a=1
>>
>> index.php?a=2&b=3
>>
>> index.php?a=1&b=2&c=4
>>
>> Can I store these the strings of GET parameters as the cache_id's to
>> cache the various permutations of pages? (something like... cache_id =
>> "a=1&b=2&c=4")
>>
>
> Sure:
> http://smarty.php.net/manual/en/caching.multiple.caches.php
>
It's worth remembering that
index.php?a=2&b=3
is the same page as
index.php?b=3&a=2
and may also be the same as
index.php?b=3&a=2&c=1
.. if c defaults to 1 in your code, but they'll all be cached separately
by this method.
This may not matter to you, of-course, but if it does a more
sophisticated (application specific) cache ID generator is needed. We
parse all passed parameters into a "$params" array which also includes
default values; we then ksort, serialize and hash the result to get an ID.
--
Mark Rogers
More Solutions Ltd :: 0845 45 89 555