@smartico/public-api 0.0.201 → 0.0.202

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.
@@ -490,14 +490,16 @@ var SAWGameLayout;
490
490
 
491
491
  class NodeCache {
492
492
  constructor() {
493
- if (NodeCache.ttlChecker === undefined) {
494
- NodeCache.ttlChecker = setInterval(() => {
493
+ this.ttlChecker = void 0;
494
+ this.cache = {};
495
+ if (this.ttlChecker === undefined) {
496
+ this.ttlChecker = setInterval(() => {
495
497
  const now = new Date().getTime();
496
- for (const key in NodeCache.cache) {
497
- if (NodeCache.cache.hasOwnProperty(key)) {
498
- const o = NodeCache.cache[key];
498
+ for (const key in this.cache) {
499
+ if (this.cache.hasOwnProperty(key)) {
500
+ const o = this.cache[key];
499
501
  if (o.ttl < now) {
500
- delete NodeCache.cache[key];
502
+ delete this.cache[key];
501
503
  }
502
504
  }
503
505
  }
@@ -505,28 +507,30 @@ class NodeCache {
505
507
  }
506
508
  }
507
509
  get(key) {
508
- const o = NodeCache.cache[key];
510
+ const o = this.cache[key];
509
511
  if (o !== undefined && o.ttl > new Date().getTime()) {
510
512
  return o.value;
511
513
  }
512
514
  }
513
515
  set(key, value, ttlSeconds = 60) {
514
- NodeCache.cache[key] = {
516
+ this.cache[key] = {
515
517
  value,
516
518
  ttl: new Date().getTime() + ttlSeconds * 1000
517
519
  };
518
520
  }
519
521
  remove(key) {
520
- if (NodeCache.cache.hasOwnProperty(key)) {
521
- delete NodeCache.cache[key];
522
+ if (this.cache.hasOwnProperty(key)) {
523
+ delete this.cache[key];
522
524
  }
523
525
  }
524
526
  flushAll() {
525
- NodeCache.cache = {};
527
+ this.cache = {};
528
+ if (this.ttlChecker) {
529
+ clearInterval(this.ttlChecker);
530
+ this.ttlChecker = undefined;
531
+ }
526
532
  }
527
533
  }
528
- NodeCache.ttlChecker = void 0;
529
- NodeCache.cache = {};
530
534
 
531
535
  var ECacheContext;
532
536
  (function (ECacheContext) {
@@ -574,6 +578,11 @@ class OCache {
574
578
  }
575
579
  }
576
580
  static async clearAll() {
581
+ for (const cacheContext in this.cache) {
582
+ if (this.cache.hasOwnProperty(cacheContext)) {
583
+ this.cache[cacheContext].flushAll();
584
+ }
585
+ }
577
586
  this.cache = {};
578
587
  }
579
588
  }