If you embed a template A into template B, using embed variables, and you switch on template caching on template A. Does template A get cached multiple times according to the embed variables? Or is the template cached once, thus losing the ability to deliver content dynamically according to the embed variables?
The way ExpressionEngine works is it parses all the templates used individually first, passing and parsing any relevant variables shared through embeds - but importantly it doesn't parse the actual embed tag during this, only once they're all done. It's at this stage that the individual template is cached. It then goes back through placing in each individual (fully parsed) template into where it needs to be inserted within the parent template.
Worth having a read of this forum post - importantly, each cached template is relevant to the URL it's on - so even if you use the same template in your footer throughout your website it won't be rendering one and then using the cached template for the others. As they use different URLs, it will create a cached version of the same template for each different URL used. So the point of caching a template is only to revisit that exact page, not share a template across multiple pages.