MCPcopy Create free account
hub / github.com/ampproject/amphtml / cacheParam

Function cacheParam

third_party/subscriptions-project/swg.js:5625–5635  ·  view source on GitHub ↗

* @param {string} cacheKey * @return {string} * @package Visible for testing only.

(cacheKey)

Source from the content-addressed store, hash-verified

5623 * @package Visible for testing only.
5624 */
5625function cacheParam(cacheKey) {
5626 let period = CACHE_KEYS[cacheKey];
5627 if (period == null) {
5628 period = 1;
5629 }
5630 if (period === 0) {
5631 return '_';
5632 }
5633 const now = Date.now();
5634 return String(period <= 1 ? now : Math.floor(now / period));
5635}
5636
5637/**
5638 * Copyright 2018 The Subscribe with Google Authors. All Rights Reserved.

Callers 1

feCachedFunction · 0.85

Calls 2

nowMethod · 0.80
StringFunction · 0.50

Tested by

no test coverage detected