Empty Super Cache programmatically (with ACF action) [closed]

This function will clear WP Super Cache upon saving of ACF Options page. Enjoy!

<?php

/* Additional Function to prune the Cache if $post_id is '0' or 'options' */
function f711_clear_custom_cache($post_id) {

    // just execute if the $post_id has either of these Values. Skip on Autosave
    if ( ( $post_id == 0 || $post_id == 'options' ) && !defined( 'DOING_AUTOSAVE' ) ) {

        // Some Super Cache Stuff
        global $blog_cache_dir;

        // Execute the Super Cache clearing, taken from original wp_cache_post_edit.php
        if ( $wp_cache_object_cache ) {
            reset_oc_version();
        } else {
            // Clear the cache. Problem: Due to the combination of different Posts used for the Slider, we have to clear the global Cache. Could result in Performance Issues due to high Server Load while deleting and creating the cache again.
            prune_super_cache( $blog_cache_dir, true );
            prune_super_cache( get_supercache_dir(), true );
        }
    }

    return $post_id;

}

// Add the new Function to the 'acf/save_post' Hook. I Use Priority 1 in this case, to be sure to execute the Function
add_action('acf/save_post', 'f711_clear_custom_cache', 1);

?>