I see.  One way to do this:
1. Make an inner function that does the actual page generation (and have it decorated with the caching header)
2. Put the "check if anything changed" logic in the outer, wrapper function, with no decorator.
Seems like a reasonable solution to me, that uses the nice things about the decorator yet gives more flexibility in checking.