fastly-purge

1.0.1 • Public • Published

Node.js' Fastly Purging API implementation

Implements Fastly Purging API, see https://docs.fastly.com/api/purge

NPM

Build Status Code Climate

Dependencies

  • Node >=0.10
  • npm >=1.2.1

Install

npm install [fastly-purge]

API

var FAKE_API_KEY = 'wadus';
 
var FAKE_PURGE_URL = 'http://example.com/image.jpg';
var FAKE_SERVICE_ID = 'wadus_service_id';
var FAKE_SURROGATE_KEY = 'wadus_key';
 
var fastlyPurge = new FastlyPurge(FAKE_API_KEY);
var fastlySoftPurge = new FastlyPurge(FAKE_API_KEY, { softPurge: true });
 
function callback(err, result) {
    console.log(err, result);
}

Instant Purge an individual URL

fastlyPurge.url(FAKE_PURGE_URL, callback);
// or
fastlySoftPurge.url(FAKE_PURGE_URL, { softPurge: false }, callback);

Instant Purge everything from a service

fastlyPurge.service(FAKE_SERVICE_ID, callback);

Note: service purging does not support soft purge

Instant Purge a particular service of items tagged with a Surrogate Key

fastlyPurge.key(FAKE_SERVICE_ID, FAKE_SURROGATE_KEY, callback);
// or
fastlySoftPurge.key(FAKE_SERVICE_ID, FAKE_SURROGATE_KEY, { softPurge: false }, callback);

Soft Purge an individual URL

fastlyPurge.url(FAKE_PURGE_URL, { softPurge: true }, callback);
// or
fastlySoftPurge.url(FAKE_PURGE_URL, callback);

Soft Purge a particular service of items tagged with a key

fastlyPurge.key(FAKE_SERVICE_ID, FAKE_SURROGATE_KEY, { softPurge: true }, callback);
// or
fastlySoftPurge.key(FAKE_SERVICE_ID, FAKE_SURROGATE_KEY, callback);

Contributing

See CONTRIBUTING.md.

Readme

Keywords

Package Sidebar

Install

npm i fastly-purge

Weekly Downloads

1,495

Version

1.0.1

License

none

Last publish

Collaborators

  • cartodb