No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
bin
config
lib
public
spec
.gitignore
.rspec
Gemfile
LICENSE
README.md
Rakefile
spree_fastly.gemspec

README.md

Spree Fastly

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.

Integration

This extension does the following:

  1. Instruments the customer-facing parts of spree_frontend with correct cache headers
  2. 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.

Optimized Resources

The following frontend controllers are optimised with cache-control headers:

  • Spree::ContentController
  • Spree::HomeController
  • Spree::ProductsController
  • Spree::TaxonsController

Additionally, the following Spree API resources receive a boost:

  • Spree::ProductsController
  • Spree::TaxonomiesController
  • Spree::TaxonsController

Special Considerations

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.

Installation

Add spree_fastly to your Gemfile:

gem 'spree_fastly'

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 /fastly_allow_api_header.vcl.

For debugging ease's sake, you might want to disable Rails' own caching mechanism:

# config/environments/production.rb
config.action_controller.perform_caching = false

Testing

First bundle your dependencies, then run rake. 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 rake test_app.

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:

require 'spree_fastly/factories'

Copyright (c) 2014 Fastly, released under the New BSD License