#!/bin/bash # Directory where your WordPress is installed WP_DIR="/var/www/webroot/ROOT" # Path to the Unix socket file for Redis REDIS_SOCKET="/var/run/redis/redis.sock" echo "Flushing caches..." # Change to the WordPress directory cd "$WP_DIR" # Flush Object Cache Pro Cache via WP CLI echo "Flushing Object Cache Pro cache..." wp redis flush --path="$WP_DIR" # Flush Relay Cache via Redis # Since Relay uses Redis, flushing Redis should also clear the Relay cache echo "Flushing Relay and Redis cache..." redis-cli -s "$REDIS_SOCKET" FLUSHALL echo "All caches have been flushed successfully."