1.2.0-alpha.2 • Published 5 years ago

amp-toolbox-update-cache v1.2.0-alpha.2

Weekly downloads
773
License
Apache-2.0
Repository
github
Last release
5 years ago

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

Generate a list of update URLs like this:

  const UpdateCacheUrlProvider = require('amp-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.

1.2.0-alpha.2

5 years ago

1.2.0-alpha.1

5 years ago

1.2.0-alpha.0

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago