I filed a RFE issue on github with code
this would allow us to have full html caching using beginCache and in the same time show dynamic content like flash message
without much varies or skipping the cache
<?php $this->dynamicPartial('//layouts/_flash') ?>