For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > May 2006 > Re: [SMARTY] Use of multiple caches per page.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [SMARTY] Use of multiple caches per page.
boots

2006-05-02, 7:07 pm

--- "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/cac...iple.caches.php

boots

________________________________________
__________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Mark Rogers

2006-05-07, 7:24 pm

boots wrote:
> --- "Tony K." <tony.kruse@gmail.com> wrote:
>
>
> Sure: http://smarty.php.net/manual/en/cac...iple.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


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com