class Chef::Provider::RemoteFile::CacheControlData

CacheControlData

Implements per-uri storage of cache control data for a remote resource along with a sanity check checksum of the file in question. Provider::RemoteFile protocol implementation classes can use this information to avoid re-fetching files when the current copy is up to date. The way this information is used is protocol-dependent. For HTTP, this information is sent to the origin server via headers to make a conditional GET request.

API

The general shape of the API is active-record-the-pattern-like. New instances should be instantiated via ‘CacheControlData.load_and_validate`, which will do a find-or-create operation and then sanity check the data against the checksum of the current copy of the file. If there is no data or the sanity check fails, the `etag` and `mtime` attributes will be set to nil; otherwise they are populated with the previously saved values.

After fetching a file, the CacheControlData instance should be updated with new etag, mtime and checksum values in whatever format is preferred by the protocol used. Then call save to save the data to disk.