Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Migrate to @ampproject/toolbox-* (#345) Jun 7, 2019
spec use lerna.js to manage packages Oct 23, 2018 Fix NPM badges Aug 6, 2019
package.json v1.0.1 Aug 6, 2019

AMP-Toolbox update-cache

npm version

Generates AMP Cache invalidation URLs for all known AMP Caches. For more info see the Google AMP Cache documentation.


Install via:

npm install @ampproject/toolbox-update-cache

Generate a list of update URLs like this:

  const UpdateCacheUrlProvider = require('@ampproject/toolbox-update-cache');

  // Load the private key, generated as described on 
  const privateKey = '...';

  // Create an instance of the factory using the private key.
  const updateCacheUrlProvider = UpdateCacheUrlProvider.create(privateKey);

    .then(cacheUpdateUrls => {
      cacheUpdateUrls.forEach(cacheUpdateUrlInfo => {
        console.log('Cache ID:' + cacheUpdateUrlInfo.cacheId);
        console.log('Cache Name:' + cacheUpdateUrlInfo.cacheName);
        console.log('cache-update URL:' + cacheUpdateUrlInfo.updateCacheUrl);

Note: this only generates the URLs, but doesn't perform the actual update request.

You can’t perform that action at this time.