mb-admin/scripts/relay/flush_caches.sh

24 lines
603 B
Bash
Raw Normal View History

2024-09-18 15:44:48 +00:00
#!/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."