If you need to save and serve different versions of the same page, I got this using a different approach.
Using the wp_cache_key filter was not saving different versions of the same page on my setup (I’m using PHP mode cache).
I did it using the supercache_filename_str filter in this way:
function my_supercache_filename_filter($extra_str) {
if(custom_criteria_satisfied()) {
$extra_str .= '__some_custom_string';
}
return $extra_str;
}
add_cacheaction('supercache_filename_str', 'my_supercache_filename_filter');
if ( function_exists( "apply_filters" ) ) {
add_filter('supercache_filename_str', 'my_supercache_filename_filter');
}
I got this from here: https://github.com/Automattic/wp-super-cache/blob/3fce4ed10dd9a991197e917d2e9568c5516dd73a/wp-cache-phase1.php#L648
Hope it helps.