title: PHP caching dynamically constructed files
body: <p>I am currently working on a small personal framework for web applications, based on the MVC pattern. In this framework some pages and templates are dynamically constructed from multiple files. However, especially these templates won't change often, so I want to create some form of caching. Ideally I only want to update the cached files when the original source files are changed, and I want to update the cached files on the first request after one of the source files is changed. But since 1 cache file is constructed from multiple source files, I need some way to know which source files belongs to a cache file, so I know which files I need to check for updates. </p>
  
  <p>I came up with the idea to either use a table in a database or a separate file which saves that information. However, this requires some extra overhead on each page request, since I'll have to read one more file or I'll have to do some database IO. Are there any other techniques I can use to have as little overhead as possible?</p>
  
  <p>ps. Caching isn't really needed since I'll only use it for a few small websites on a server which is far too powerful for these websites. However, I think it's a good practice for me to become more used to caching techniques.</p>