Built with the wisdom that performant eCommerce stores generate more revenue, this extension integrates Spree store installations with Fastly's advanced edge-caching technologies. Cache invalidation is performed by means of observing models and expiry via surrogate keys.
This extension does the following:
- Instruments the customer-facing parts of spree_frontend with correct cache headers
- Observers changes to key Spree models (and relations) for cache invalidation
As a consequence, you can expect to lower HTTP response times drastically. Additionally, since the majority of requests are expected to short-circuit at edge locations, the carrying capacity of your hosting tier is effectively boosted.
The following frontend controllers are optimised with cache-control headers:
Additionally, the following Spree API resources receive a boost:
Due to template and asset changes upon deployment it is wise to invalidate the cached views in bulk.
bundle exec rake spree_fastly:purge_all
Rails Asset Pipeline's built-in asset digest feature will ensure freshness of your CSS and JS assets since these are not tagged with surrogate keys.
Add spree_fastly to your Gemfile:
Bundle your dependencies and run the installation generator:
bundle bundle exec rails g spree_fastly:install
The extension comes with a special VCL to use with Fastly, it can be found at
/fastly_default.vcl. If you plan to use the API auth with the header style token, also review
For debugging ease's sake, you might want to disable Rails' own caching mechanism:
# config/environments/production.rb config.action_controller.perform_caching = false
First bundle your dependencies, then run
rake will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using
bundle bundle exec rake
When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:
Copyright (c) 2014 Fastly, released under the New BSD License