expf-sigma-node.js 1.2.1 → 1.2.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/public/sigma.js +5 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expf-sigma-node.js",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "expf-sigma-node.js lets you manage features flags and remote config across web, server side applications. Deliver true Continuous Integration. Get builds out faster. Control who has access to new features.",
5
5
  "main": "public/sigma.js",
6
6
  "keywords": [
package/public/sigma.js CHANGED
@@ -110,9 +110,7 @@ var SigmaUserData = class {
110
110
  var import_node_cache = __toESM(require("node-cache"));
111
111
  var sigmaCache = new import_node_cache.default();
112
112
  var SigmaCache = class {
113
- constructor(postfix, geoCacheTTL) {
114
- this.geoCacheTTL = geoCacheTTL || null;
115
- this.sigmaGeoCache = new import_node_cache.default({ stdTTL: this.geoCacheTTL });
113
+ constructor(postfix) {
116
114
  this.postfix = "";
117
115
  if (postfix)
118
116
  this.postfix = "__" + postfix;
@@ -145,39 +143,33 @@ var import_node_cache2 = __toESM(require("node-cache"));
145
143
  var defaultGeoCacheTTL = 5 * 60;
146
144
  var maxGeoCacheTTL = 120 * 60;
147
145
  var minGeoCacheTTL = 1 * 60;
146
+ var sigmaGeoCache = new import_node_cache2.default();
148
147
  var SigmaGeoCache = class {
149
148
  constructor(postfix, geoCacheTTL) {
150
149
  this.geoCacheTTL = geoCacheTTL || defaultGeoCacheTTL;
151
150
  if (geoCacheTTL > maxGeoCacheTTL || geoCacheTTL < minGeoCacheTTL) {
152
151
  this.geoCacheTTL = defaultGeoCacheTTL;
153
152
  }
154
- this.sigmaGeoCache = new import_node_cache2.default({ stdTTL: this.geoCacheTTL });
155
153
  this.postfix = "";
156
154
  if (postfix)
157
155
  this.postfix = "__" + postfix;
158
156
  }
159
157
  get(key) {
160
158
  try {
161
- return this.sigmaGeoCache.get(key + this.postfix);
159
+ return sigmaGeoCache.get(key + this.postfix);
162
160
  } catch (e) {
163
161
  console.log(e);
164
162
  }
165
163
  }
166
164
  set(key, value) {
167
165
  try {
168
- return this.sigmaGeoCache.set(key + this.postfix, value);
166
+ return sigmaGeoCache.set(key + this.postfix, value, this.geoCacheTTL);
169
167
  } catch (e) {
170
168
  console.log(e);
171
169
  }
172
170
  }
173
171
  keys() {
174
- return this.sigmaGeoCache.keys();
175
- }
176
- parse(data) {
177
- if (!this.get(data)) {
178
- throw new Error(`${data} not found in cache`);
179
- }
180
- return JSON.parse(this.get(data));
172
+ return sigmaGeoCache.keys();
181
173
  }
182
174
  };
183
175
 
@@ -924,7 +916,6 @@ var defaultApi = "https://api.expf.ru/api/v1";
924
916
  var sigmaUserId = "sigmaUserId";
925
917
  var sigmaDataFile = "sigmaDataFile";
926
918
  var sigmaExperiments = "sigmaExperiments";
927
- var sigmaGeoData = "sigmaGeoData";
928
919
  var SHA256 = new sigmaHashes_default.SHA256();
929
920
  var MD5 = new sigmaHashes_default.MD5();
930
921
  var max_decimal_64 = 18446744073709552e3;
@@ -1488,10 +1479,6 @@ var Sigma = class {
1488
1479
  const data = await this.cache.get("sigmaHash");
1489
1480
  return data;
1490
1481
  }
1491
- async getCacheGeoData() {
1492
- const data = await this.cache.get(sigmaGeoData);
1493
- return data;
1494
- }
1495
1482
  async getCacheUserId() {
1496
1483
  const data = await this.cache.get(sigmaUserId);
1497
1484
  return data;