I need a way to detect changes of my database because I'm implementing a caching system on a client's site. (caching the whole page, not just the queries)
At the top of the every page (i have a "master page" so just one place in code) I query the database to see if its size is changed like so.
I sum the size and get a "unique" number. Compare it to the previous one, and if the values are the same, deliver the cached page, if not, run the "normal" page and then cache that.
So I think in theory this could work, because I have just 1 database query, and based on that deliver the site (cached or uncached depending on the result) to the user.
Could this work, and if not - why?
EDIT:
what about cheking for the last update timestamp? LINK