AMP-Toolbox update-cache
![npm version](https://badge.fury.io/js/amp-toolbox-update-cache.svg)
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');
const privateKey = '...';
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.