Skip to content

Instantly share code, notes, and snippets.

@levicole
Created September 16, 2014 22:28
Show Gist options
  • Save levicole/a8fed64fb9d1ab94e68c to your computer and use it in GitHub Desktop.
Save levicole/a8fed64fb9d1ab94e68c to your computer and use it in GitHub Desktop.
namespace :cache do
desc "Clear memcache (no-op for cold deploys)"
task :clear, :roles => :app do
# for cold deploys current_path does not exist, but there is no cached content yet so skip it.
run "([ -d #{current_path} ] && cd #{current_path} && bundle exec rake RAILS_ENV=#{rails_env} cache:clear) || echo 'Not clearing cache since current_path is not defined, therefore there is no cache'"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment