New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ivfuture/ecomm-cache-inmemory

Package Overview
Dependencies
Maintainers
0
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ivfuture/ecomm-cache-inmemory - npm Package Compare versions

Comparing version 1.57.4 to 1.57.5

dist/index.d.ts

14

dist/services/inmemory-cache.d.ts
/// <reference types="node" />
import { AbstractCacheService } from "@ivfuture/ecomm-core";
import { Logger, MedusaContainer } from "@ivfuture/ecomm-types";
import { ICacheService } from "@ivfuture/ecomm-types";
import { CacheRecord, InMemoryCacheModuleOptions } from "../types";
type InjectedDependencies = {};
/**
* Class represents a basic, in-memory cache store.
* Class represents basic, in-memory, cache store.
*/
declare class InMemoryCacheService extends AbstractCacheService {
declare class InMemoryCacheService implements ICacheService {
protected readonly TTL: number;
protected readonly store: Map<string, CacheRecord<any>>;
protected readonly timeoutRefs: Map<string, NodeJS.Timeout>;
protected readonly logger_: Logger;
constructor(container: MedusaContainer, _options?: InMemoryCacheModuleOptions);
protected readonly timoutRefs: Map<string, NodeJS.Timeout>;
constructor(deps: InjectedDependencies, options?: InMemoryCacheModuleOptions);
/**

@@ -14,0 +14,0 @@ * Retrieve data from the cache.

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -54,14 +39,13 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

Object.defineProperty(exports, "__esModule", { value: true });
var ecomm_core_1 = require("@ivfuture/ecomm-core");
var DEFAULT_TTL = 30; // seconds
/**
* Class represents a basic, in-memory cache store.
* Class represents basic, in-memory, cache store.
*/
var InMemoryCacheService = /** @class */ (function (_super) {
__extends(InMemoryCacheService, _super);
function InMemoryCacheService(container, _options) {
if (_options === void 0) { _options = {}; }
var _this = _super.call(this, container) || this;
_this.store = new Map();
_this.timeoutRefs = new Map();
return _this;
var InMemoryCacheService = /** @class */ (function () {
function InMemoryCacheService(deps, options) {
if (options === void 0) { options = {}; }
var _a;
this.store = new Map();
this.timoutRefs = new Map();
this.TTL = (_a = options.ttl) !== null && _a !== void 0 ? _a : DEFAULT_TTL;
}

@@ -102,4 +86,4 @@ /**

if (oldRecord) {
clearTimeout(this.timeoutRefs.get(key));
this.timeoutRefs.delete(key);
clearTimeout(this.timoutRefs.get(key));
this.timoutRefs.delete(key);
}

@@ -110,3 +94,3 @@ ref = setTimeout(function () {

ref.unref();
this.timeoutRefs.set(key, ref);
this.timoutRefs.set(key, ref);
this.store.set(key, record);

@@ -134,6 +118,6 @@ return [2 /*return*/];

keys.forEach(function (key) {
var timeoutRef = _this.timeoutRefs.get(key);
var timeoutRef = _this.timoutRefs.get(key);
if (timeoutRef) {
clearTimeout(timeoutRef);
_this.timeoutRefs.delete(key);
_this.timoutRefs.delete(key);
}

@@ -152,4 +136,4 @@ _this.store.delete(key);

return __generator(this, function (_a) {
this.timeoutRefs.forEach(function (ref) { return clearTimeout(ref); });
this.timeoutRefs.clear();
this.timoutRefs.forEach(function (ref) { return clearTimeout(ref); });
this.timoutRefs.clear();
this.store.clear();

@@ -161,4 +145,4 @@ return [2 /*return*/];

return InMemoryCacheService;
}(ecomm_core_1.AbstractCacheService));
}());
exports.default = InMemoryCacheService;
//# sourceMappingURL=inmemory-cache.js.map
{
"name": "@ivfuture/ecomm-cache-inmemory",
"version": "1.57.4",
"version": "1.57.5",
"description": "In-memory Cache Module for Medusa",

@@ -20,3 +20,3 @@ "main": "dist/index.js",

"devDependencies": {
"@ivfuture/ecomm-types": "1.57.2",
"@ivfuture/ecomm-types": "1.57.3",
"cross-env": "^7.0.3",

@@ -36,5 +36,5 @@ "jest": "^29.7.0",

"dependencies": {
"@ivfuture/ecomm-core": "2.69.8"
"@ivfuture/ecomm-modules-sdk": "1.57.2"
},
"gitHead": "a4101ec86208a6f6396873398626ad58794cb6d0"
"gitHead": "5b674270a3916ccf9fe07e5965a90341597b118f"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc