Title: flush Redis by php
Last modified: September 1, 2020

---

# flush Redis by php

 *  Resolved [cosmoweb](https://wordpress.org/support/users/cosmoweb/)
 * (@cosmoweb)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/flush-redis-by-php/)
 * Hi,
 * I’d like flush Redis every day by php with cron.
 * I have to use the follow string?
 * $redis->flushAll();
 * Thanks

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

 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/flush-redis-by-php/#post-13347097)
 * I’d just call `wp_cache_flush()` from your cron, or set a MaxTTL: [https://github.com/rhubarbgroup/redis-cache/wiki/Configuration-Options#wp_redis_maxttl-default-not-set](https://github.com/rhubarbgroup/redis-cache/wiki/Configuration-Options#wp_redis_maxttl-default-not-set)
 * If you NEED to flush ALL databases, you could do this:
 *     ```
       global $wp_object_cache;
   
       $wp_object_cache->redis_instance()->flushall();
       ```
   
 *  Thread Starter [cosmoweb](https://wordpress.org/support/users/cosmoweb/)
 * (@cosmoweb)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/flush-redis-by-php/#post-13347127)
 * Hi [@tillkruess](https://wordpress.org/support/users/tillkruess/) thanks for 
   reply,
 * every how many hours do you advise me to flush all database?
 * Thanks
 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/flush-redis-by-php/#post-13347224)
 * Before and after WordPress updates, other than that I let it be.

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

The topic ‘flush Redis by php’ is closed to new replies.

 * ![](https://ps.w.org/redis-cache/assets/icon-256x256.gif?rev=2568513)
 * [Redis Object Cache](https://wordpress.org/plugins/redis-cache/)
 * [Support Threads](https://wordpress.org/support/plugin/redis-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/redis-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/redis-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/redis-cache/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * Last activity: [5 years, 9 months ago](https://wordpress.org/support/topic/flush-redis-by-php/#post-13347224)
 * Status: resolved