Title: Flushing cache programmatically resets cache engine
Last modified: June 28, 2023

---

# Flushing cache programmatically resets cache engine

 *  Resolved [tomowow](https://wordpress.org/support/users/tomowow/)
 * (@tomowow)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/flushing-cache-programmatically-resets-cache-engine/)
 * We added a WP CLI command in our deploy script, so we don’t need to flush the
   cache manually after every edit. 
   `php wp-cli.phar w3-total-cache flush all`This
   flushes the cache correctly, but also resets the page cache method. We use **
   Redis**, but after every deploy the method is set to **Disk enhanced**. How can
   we fix this? Already tried looking in `cli.php` if there is a command to change
   this setting after flushing, but no luck yet.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/flushing-cache-programmatically-resets-cache-engine/#post-16854500)
 * Hello [@tomowow](https://wordpress.org/support/users/tomowow/)
 * Thank you for reaching out and I am happy to help!
 * Well this is very strange and this should not be happening
 * Is there any reason you are using php wp-cli.phar instead of just calling `wp
   w3-total-cache flush all`
 * Thanks!
 *  Thread Starter [tomowow](https://wordpress.org/support/users/tomowow/)
 * (@tomowow)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/flushing-cache-programmatically-resets-cache-engine/#post-16855059)
 * Hi Marko, we had some struggles with the installation of wp-cli on our server,
   therefore the `wp` command is undefined on our server at the moment. Because 
   we need to do this step for every server, we decided to just use `php wp-cli.
   phar` for now. This does exactly the same as the `wp` command, so that can’t 
   be the cause I guess.
 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/flushing-cache-programmatically-resets-cache-engine/#post-16855399)
 * Hello [@tomowow](https://wordpress.org/support/users/tomowow/)
 * Thank you for your feedback.
 * I cannot seem to replicate the problem, so this must be related to your server
   and the wp-cli installation.
 * You can find more information about wp-cli commands in the W3 Total Cache in /
   wp-content/plugins/w3-total-cache/Cli.php
 * I hope this helps!
 * Thanks!
 *  Thread Starter [tomowow](https://wordpress.org/support/users/tomowow/)
 * (@tomowow)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/flushing-cache-programmatically-resets-cache-engine/#post-16859364)
 * Hi Marko, we tried finding a cause on our server, but no success.
 * While analysing, we notice that the Redis setting is removed from this plugin
   file after deploy: `/home/forge/site.dev/client/assets/w3tc-config/master.php`
   
   What we did now is execute a command that restores the Redis option after the
   flush with `sed -i` command.If you have any other ideas, let us know.
 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/flushing-cache-programmatically-resets-cache-engine/#post-16859844)
 * Hello [@tomowow](https://wordpress.org/support/users/tomowow/)
 * The /w3tc-config/master.php is the configuration file. I’ve tried replicating
   this however, once i call wp w3-total-cache flush all the cache is purged, however,
   the caching method remains the same.
 * Can you please share the screenshot of the Performance>Page Cache section?
 * Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Flushing cache programmatically resets cache engine’ is closed to new
replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * Last activity: [2 years, 11 months ago](https://wordpress.org/support/topic/flushing-cache-programmatically-resets-cache-engine/#post-16859844)
 * Status: resolved