Last active
August 29, 2015 14:23
-
-
Save tmlangley/8c7fa1f8a73b3e675378 to your computer and use it in GitHub Desktop.
Drush cache clear
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Clear specific drupal cache table with drush | |
# $1 - Cache table or "theme" for css-js. | |
# $2 - Environment drush alias. Ex: @mysite.dev | |
_drcc() { | |
# alias "css-js" to "theme" because I can never remember which comes first. | |
if [ "$1" == "theme" ] ; then | |
table="css-js" | |
else | |
table=$1 | |
fi | |
if [ -z "$2" ]; then | |
# Redirect the output to /dev/null so we can do a custom message. | |
drush cc "$table" &> /dev/null | |
echo "Cleared $table cache on the current environment." | |
else | |
# Redirect the output to /dev/null so we can do a custom message. | |
drush "$2" cc "$table" &> /dev/null | |
echo "Cleared $table cache on $2." | |
fi | |
} | |
alias drcc="_drcc" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Examples
Clear menu cache on @mysite.dev:
drcc menu @mysite.dev
Clear css-js cache on the current local environment:
drcc css-js
or...
drcc theme
This works because "theme" has been aliased to "css-js" since I can never remember if it's "css-js" or "js-css"