redis-distributed-cache-tools 1.0.59 → 1.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getHotKey = void 0;
3
+ exports.getHotKey = getHotKey;
4
4
  function getHotKey(key, numberOfSeperate) {
5
5
  if (numberOfSeperate === undefined || numberOfSeperate === 0) {
6
6
  return key;
7
7
  }
8
8
  return `${Math.floor(Math.random() * numberOfSeperate)}:${key}`;
9
9
  }
10
- exports.getHotKey = getHotKey;
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getJitter = void 0;
3
+ exports.getJitter = getJitter;
4
4
  function getJitter(minutes, jitter) {
5
5
  const max = minutes * 60;
6
6
  const min = minutes * (1 - jitter) * 60;
7
7
  return Math.floor(Math.random() * (max - min) + min);
8
8
  }
9
- exports.getJitter = getJitter;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shouldRecompute = void 0;
3
+ exports.shouldRecompute = shouldRecompute;
4
4
  function shouldRecompute(lastDuration, keyTtlSeconds, maxEarlyRecomputeSeconds = 0, beta = 1) {
5
5
  if (keyTtlSeconds < 1 || lastDuration < 1) {
6
6
  return false;
@@ -19,4 +19,3 @@ function shouldRecompute(lastDuration, keyTtlSeconds, maxEarlyRecomputeSeconds =
19
19
  const isEarlyRecomputeRequired = currentTimestampInSeconds - xfetch >= cacheExpireAt;
20
20
  return isEarlyRecomputeRequired;
21
21
  }
22
- exports.shouldRecompute = shouldRecompute;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redis-distributed-cache-tools",
3
- "version": "1.0.59",
3
+ "version": "1.0.60",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",