@ampproject/toolbox-update-cache

2.10.1 • Public • Published

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.

Usage

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 
  // https://developers.google.com/amp/cache/update-cache#rsa-keys
  const privateKey = '...';

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

  updateCacheUrlProvider.calculateFromOriginUrl('https://www.example.com')
    .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.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.0.0-canary.20canary
2.7.0-alpha.10alpha
1.1.0-beta.00beta
2.10.113latest

Version History

VersionDownloads (Last 7 Days)Published
2.10.113
2.10.02
2.9.01
3.0.0-canary.20
2.8.00
2.8.0-canary.151
2.8.0-canary.90
2.8.0-canary.61
2.8.0-canary.41
2.8.0-canary.21
2.8.0-canary.00
2.7.60
2.7.50
2.7.41
2.7.20
2.7.10
2.7.1-alpha.00
2.7.0-alpha.10
2.6.01
2.5.60
2.5.40
2.5.10
2.5.00
2.4.0-alpha.10
2.4.0-alpha.01
2.3.00
2.2.01
2.1.00
2.0.00
2.0.0-alpha.40
2.0.0-alpha.01
1.1.10
1.1.00
1.1.0-beta.10
1.1.0-beta.00
1.0.11
1.0.00
1.0.0-beta.91
1.0.0-beta.81
1.0.0-beta.70
1.0.0-beta.61
1.0.0-beta.51
1.0.0-beta.40
1.0.0-beta.31
1.0.0-beta.21
1.0.0-beta.01

Package Sidebar

Install

npm i @ampproject/toolbox-update-cache

Weekly Downloads

7

Version

2.10.1

License

Apache-2.0

Unpacked Size

7.96 kB

Total Files

5

Last publish

Collaborators

  • ampproject-admin
  • kristoferbaxter
  • jridgewell
  • choumx
  • amp-toolbox
  • fstanis
  • erwinmombay
  • samouri
  • caroqliu
  • rsimha
  • dvoytenko
  • patrickkettner
  • alanorozco
  • kdwan
  • ampprojectbot
  • esth