To delete all cache using Predis in PHP, you can use the flushall() method. Here's a simple example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<?php require 'predis/autoload.php'; Predis\Autoloader::register(); $client = new Predis\Client(); // Flush all cache $client->flushall(); echo "Cache flushed successfully!"; |
This code snippet initializes a Predis client and then calls the flushall() method on it, which deletes all keys from the currently selected database.