I\'m currently using a Cache Manifest (as described here). This effectively makes the necessary resources to run the application available when the user is offline.
Disclaimer: my experience with manifests and cache is all Safari and FF may handle some things differently.
You are quite right. If there are any files listed on the manifest that can't be found, no caching will occur.
Even if you are online, the browser will check only the manifest file. While waiting for the manifest file, it will continue to load the site from the cache - that way it doesn't delay rendering - but it means that you don't see any changes on the first load.
The next time the site is loaded, if the manifest changed on the previous load, the new files will be loaded.
IT IS ALWAYS NECESSARY TO RELOAD TWICE to see any changes. In fact, I have sometimes had to reload 3 times to see the update. No idea why.
When debugging, I generate my manifest file on the fly with php, so there is no chance of a typo in a filename. I also generate the version number randomly each time to force an update but still have an offline webapp for testing.
Once complete, the php file can just echo the saved manifest data with a constant version number and the cache will always be used.
Just some things I have learned while playing with manifest and cache recently. It works great, but can be confusing.
There is no expiry. To uncache, you have to change the manifest file to have nothing in it and do a reload. On Safari, clearing the user cache does clear out all cached files.