I am working with dynamic caching myself right now, I believe that you could duplicate it, but that the simplest most surefire way to make it all work would be to copy all the functions, add_cacheaction calls, and add_action calls and rename them for each instance. You would also need to update the DEFINE statements as well. You would need to be careful to ensure you got all instances duplicated and matching.
So
define( 'DYNAMIC_OUTPUT_BUFFER_TAG', '' );
could become
define( 'DYNAMIC_OUTPUT_BUFFER_TAG2', '' );
and each function would also need updating, so for example here I’ve appended a “2” to the function names and DEFINE constants:
function dynamic_output_buffer_test2( &$cachedata = 0 ) {
if ( defined( 'DYNAMIC_OB_TEXT2' ) )
return str_replace( DYNAMIC_OUTPUT_BUFFER_TAG2, DYNAMIC_OB_TEXT2, $cachedata );
ob_start();
// your dynamic content goes here
$text = ob_get_contents();
ob_end_clean();
if ( $cachedata === 0 ) { // called directly from the theme so store the output
define( 'DYNAMIC_OB_TEXT2', $text );
} else // called via the wpsc_cachedata filter. We only get here in cached pages in wp-cache-phase1.php
return str_replace( DYNAMIC_OUTPUT_BUFFER_TAG2, $text, $cachedata );
}
add_cacheaction( 'wpsc_cachedata', 'dynamic_output_buffer_test2' );
Good luck!