aceband Posted July 28, 2009 Share Posted July 28, 2009 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 More sharing options...
PFMaBiSmAd Posted July 28, 2009 Share Posted July 28, 2009 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. Link to comment https://forums.phpfreaks.com/topic/167846-template-engines-how-does-cache-work/#findComment-885255 Share on other sites More sharing options...
aceband Posted July 28, 2009 Author Share Posted July 28, 2009 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? Link to comment https://forums.phpfreaks.com/topic/167846-template-engines-how-does-cache-work/#findComment-885256 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.