Hello Celine,
Thank you for your inquiry and I am happy to assist you with this.
You can use w3tc_flush_all
You can check more functions in wp-content/plugins/w3-total-cache/w3-total-cache-api.php
In this case the function:
/**
* Purges/Flushes everything
*/
function w3tc_flush_all( $extras = null ) {
$o = \W3TC\Dispatcher::component( 'CacheFlush' );
$o->flush_all( $extras );
Thanks!