Skip to content

Instantly share code, notes, and snippets.

@skolman
Created December 1, 2014 15:35
Show Gist options
  • Save skolman/c4fb8abf5f92dcf27452 to your computer and use it in GitHub Desktop.
Save skolman/c4fb8abf5f92dcf27452 to your computer and use it in GitHub Desktop.
namespace :apc do
desc <<-DESC
Create a temporary PHP file to clear APC cache, call it (using curl) and removes it
This task must be triggered AFTER the deployment to clear APC cache
DESC
task :clear_cache do
front_url = fetch(:front_url)
apc_script_path = fetch(:apc_script_path)
on roles(:web) do
puts capture("cd #{apc_script_path}; echo '<?php apc_clear_cache(); apc_clear_cache('user'); ?>' > apc_clear_454546.php")
puts capture("cd #{apc_script_path}; curl -s #{front_url}/apc_clear_454546.php && rm -f apc_clear_454546.php")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment