Jump to content

Template Cache: Define cache forking variables


tsdtsdtsd
 Share

Recommended Posts

Hey mates,

when setting up template caching, we are able to define "Cache disabling GET variables".

While this is very useful, I would like to propose the ability to define "Cache forking GET variables".

The given variables (and their combinations) would then create seperate cache files for different values.

Basicly, whenever we use GET/POST parameters in our application, we are not able to serve cached content, while there are lots of situations where it would make sense.

I think that this is a mayor caching mechanism in general.

The performance impact should be minimal, but I smell a little security problem: I/O impact could get interresting, if someone bombards your site with requests with random values for known variables.

I have no clue how the big caching engines out there manage this problem. Any ideas? Please discuss :)

Cheers

BTW: Does someone know how processwire handles the caching with url segments and page numbers? Never tried...

Link to comment
Share on other sites

BTW: Does someone know how processwire handles the caching with url segments and page numbers? Never tried...

 

Works perfectly !

I sometimes use 'file based' url segments. Then I create for every URL segment a (nested) folder.

// urlsegments folder in the templates folder, when the urlsegment is there, load it!
if ($input->urlSegmentStr && $page->id !== $config->http404PageID) {
    $segment = './urlsegments' . $page->url . $input->urlSegmentStr . '/segment.php';
    if (!is_file($segment)) { throw new Wire404Exception(); }
    return include($segment);
}
  • Like 2
Link to comment
Share on other sites

Thanks Martijn!

Just played around with it a little myself.

As a great marketing-guy (who I am not), let me clarify it this way *cough*:

processwire encourages the user to use a sophisticated url structure (in favour of e.g. security, SEO) through forced non-cachability of oldschool parameterized pages.

Does this make any sense? Sounds good to me  :lol:

Anyways, to be a little more technical again: 

What I do want to get cached? 

Static or dynamic content, which can be influenced by 'some kind of' variable. This is possible through "url segments" configuration, I don't need to use classic GET for that job -> check

What I do not want to get cached?

Content that is specific for a session/user. Content for a single session can still be dynamic by GET/POST-parameters, but we don't wan that to be cached - and it can't anyway ;) -> check

So my initial proposal isn't necessary at all and this thread can be closed.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...