Cold FeetUser Guide

Overview

Cold Feet is a support library that aids Alien-Factory in the development of libraries, frameworks and applications. Though you are welcome to use it, you may find features are missing and the documentation incomplete.

Cold Feet is an asset caching strategy for your Bed App.

  • Tired of telling your clients to clear their cache to pick up the latest CSS and Javascript changes?
  • Don't want to use lame browser cache busting because you need network performance?
  • Then get Cold Feet!

Install

Install Cold Feet with the Fantom Repository Manager ( fanr ):

$ fanr install -r http://repo.status302.com/fanr/ afColdFeet

To use in a Fantom project, add a dependency to build.fan:

depends = ["sys 1.0", ..., "afColdFeet 0+"]

Usage

Use the ColdFeet service to convert your asset URIs, such as /css/myStyles.css, to a Cold Feet URI like /coldFeet/XXXX/css/myStyles.css, where:

  • /coldFeet is a prefix used to identify the URI on incoming requests.
  • /XXXX is a checksum, generated by Cold Feet, that changes when the asset content changes.

When a request is made for the asset using the modified URI, Cold Feet intercepts the request using BedSheet middleware and serves up the file. Cold Feet lets the browser aggressively cache it by setting a far-future expiration header (10 years by default).

If during those 10 years the asset is modified then the Cold Feet URI will change, as the XXXX checksum will be updated. This forces the browser to download the new asset.

The smart ones amongst you will be asking, "But what if the browser requests an old asset URI?" Simple, Cold Feet recognises outdated URIs and responds with a 301 - Moved Permanently redirecting the browser to the new asset URI.

Checksum Strategies

App Version

This simple strategy (currently the default) ignores the asset file in question and returns the application's pod version. Thus, when a new application is deployed (with an updated version), all clients will re-download the assets.

When not in production mode, the checksum defaults to a random string and the expiration header is disabled.

Release Notes

v0.0.2

  • New: Preview Release