Page 1 of 1

Making an Advanced cache system

Posted: Fri May 28, 2010 12:44 am
by afshin.m
Hello,

I'm programming an advanced caching system that work with PHP but i have an small problem.

I want to know when the pages content changed to remove the page cache from cache folder and make a new cache file with new content.

i don't want to work with cache time...

Please help me, thanks a lot. :)

Re: Making an Advanced cache system

Posted: Fri May 28, 2010 1:12 am
by John Cartwright

Re: Making an Advanced cache system

Posted: Fri May 28, 2010 1:55 am
by afshin.m
okay, i know this function and also use it now but i don't want to work with Time, i want to changed and renew my cache file ONLY when the page content changed.

Thank you

Re: Making an Advanced cache system

Posted: Fri May 28, 2010 2:18 am
by Brenden
Well that's just the thing. In order to detect if the page has changed, you need to run the process that creates the page, in which case there's no point at caching at all. What I would do is approach it by either doing it at a regular interval, or running enough of the script to determine if the full script will change - ie, if the page involves listing and processing information from a database, keep track of how many items are on the list then refresh the cached page if that number increases. That way you are using SELECT COUNT(*) FROM table instead of running the entire script.