Created
May 29, 2014 01:05
-
-
Save mmay/8c7294c4204bbb192e3c to your computer and use it in GitHub Desktop.
Fastly Purge
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
fastly = Fastly.new(api_key: FASTLY_API_KEY) | |
# Site wide purge | |
s = fastly.get_service service_id | |
s.purge_all | |
# URL Purge | |
# "www.cool.com/blah.json" | |
fastly.purge("/blah.json") | |
# Surrogate-Key Purge | |
# In controller GET actions | |
response.headers['Surrogate-Control'] = "max-age=3600" | |
response.headers['Surrogate-Key'] = "mykey" | |
# In controller PUT, POST, DELETE actions | |
fastly.purge("mykey") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment