2.8.0 • Published 5 months ago

@ampproject/toolbox-cache-list v2.8.0

Weekly downloads
2,222
License
Apache-2.0
Repository
github
Last release
5 months ago

AMP-Toolbox Cache List

npm version

Lists known AMP Caches, as available at https://cdn.ampproject.org/caches.json.

By default, it uses a one-behind caching strategy to fetch the caches. This can be customised by passing a custom fetch strategy to the constructor.

Usage

Install via:

$ npm install @ampproject/toolbox-cache-list@beta

List all known caches:

  const Caches = require('@ampproject/toolbox-cache-list');

  const allCaches = await Caches.list();

Which will return:

[
  {
    "id": "google",
    "name": "Google AMP Cache",
    "docs": "https://developers.google.com/amp/cache/",
    "cacheDomain": "cdn.ampproject.org",
    "updateCacheApiDomainSuffix": "cdn.ampproject.org",
    "thirdPartyFrameDomainSuffix": "ampproject.net"
  },
  {
    "id": "cloudflare",
    "name": "Cloudflare AMP Cache",
    "docs": "https://amp.cloudflare.com/",
    "cacheDomain": "amp.cloudflare.com",
    "updateCacheApiDomainSuffix": "amp.cloudflare.com",
    "thirdPartyFrameDomainSuffix": "cloudflareamp.net"
  },
  {
    "id": "bing",
    "name": "Bing AMP Cache",
    "docs": "https://www.bing.com/webmaster/help/bing-amp-cache-bc1c884c",
    "cacheDomain": "bing-amp.com",
    "updateCacheApiDomainSuffix": "bing-amp.com",
    "thirdPartyFrameDomainSuffix": "bing-amp.net"
  }
] 

Fetching info about a specific AMP cache via the cache id:

  const Caches = require('@ampproject/toolbox-cache-list');

  const googleAmpCache = await Caches.get('google');

Which will return:

{
  "id": "google",
  "name": "Google AMP Cache",
  "docs": "https://developers.google.com/amp/cache/",
  "cacheDomain": "cdn.ampproject.org",
  "updateCacheApiDomainSuffix": "cdn.ampproject.org",
  "thirdPartyFrameDomainSuffix": "ampproject.net"
}
3.0.0-canary.2

5 months ago

2.8.0

12 months ago

2.8.0-canary.15

1 year ago

2.8.0-canary.9

1 year ago

2.8.0-canary.0

1 year ago

2.7.4

1 year ago

2.7.2

1 year ago

2.7.1

1 year ago

2.7.1-alpha.0

1 year ago

2.6.0

2 years ago

2.5.4

2 years ago

2.5.1

2 years ago

2.5.0

2 years ago

2.4.0-alpha.1

2 years ago

2.4.0-alpha.0

2 years ago

2.3.0

2 years ago

2.2.0

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

2.0.0-alpha.4

2 years ago

2.0.0-alpha.0

2 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.0-beta.1

3 years ago

1.1.0-beta.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.0-beta.9

3 years ago

1.0.0-beta.8

3 years ago

1.0.0-beta.7

3 years ago

1.0.0-beta.6

3 years ago

1.0.0-beta.5

3 years ago

1.0.0-beta.4

3 years ago

1.0.0-beta.3

3 years ago

1.0.0-beta.2

3 years ago

1.0.0-beta.1

3 years ago

1.0.0-beta.0

3 years ago