Jump to content

template engines - how does cache work?


aceband

Recommended Posts

Hi there,

 

Just writing a template engine/system type thing and I'm REALLY struggling to get my head around the cache side of things. I understand how to store a cache of the template into a file and pull a cached filed but i don't understand how the script knows when the data it is pulling from the database to populate the Page has changed and thus needs to regenerate the page. Surely it can only know if the data has changed by comparing the cache file fully with a freshly generated version but doesn't this defeat the object because you're regenerating anyway?!

 

I know this can't be true but i just can't work it out - pleas help?!... it keeps me up a night!!

Link to comment
https://forums.phpfreaks.com/topic/167846-template-engines-how-does-cache-work/
Share on other sites

Perhaps examining how caching is used in an existing template - http://www.smarty.net/manual/en/caching.php

 

If a page has dynamic data on it that could change from one page request to the next, you would not enable caching for that page.

I've had a browse through but I'm hoping to apply it to a web-forum situation. I see that most all popular forums have a 'cache system' but how does this work with new posts and topics etc being created so frequently. What exactly is cached. Is it say small parts of the overall page or the whole thing?

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.