If you type:
into the firefox addressbar, you see some very interesting information about what is cached. Some files go into the memory cache and some into the disk cache. How does firefox decide when to use each one?
Most recently accessed resources try to fit into memory, beyond that gets saved to disk. When Firefox tries to render a page it 1st checks memory cache for a given resource, then disk cache and if both are empty it tries to fetch it from a source location and if it can't do that, it renders an appropriate error message.