@type-cacheable/node-cache-adapter
Advanced tools
Comparing version
@@ -1,3 +0,3 @@ | ||
import * as NodeCache from 'node-cache'; | ||
import { CacheClient } from '@type-cacheable/core'; | ||
import NodeCache from 'node-cache'; | ||
import { CacheClient, CacheManagerOptions } from '@type-cacheable/core'; | ||
export declare class NodeCacheAdapter implements CacheClient { | ||
@@ -22,2 +22,2 @@ private nodeCacheClient; | ||
} | ||
export declare const useAdapter: (client: NodeCache, asFallback?: boolean) => NodeCacheAdapter; | ||
export declare const useAdapter: (client: NodeCache, asFallback?: boolean, options?: CacheManagerOptions) => NodeCacheAdapter; |
@@ -11,5 +11,8 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.useAdapter = exports.NodeCacheAdapter = void 0; | ||
const core_1 = require("@type-cacheable/core"); | ||
const core_1 = __importDefault(require("@type-cacheable/core")); | ||
class NodeCacheAdapter { | ||
@@ -79,3 +82,3 @@ constructor(nodeCacheClient) { | ||
exports.NodeCacheAdapter = NodeCacheAdapter; | ||
const useAdapter = (client, asFallback) => { | ||
const useAdapter = (client, asFallback, options) => { | ||
const nodeCacheAdapter = new NodeCacheAdapter(client); | ||
@@ -88,2 +91,5 @@ if (asFallback) { | ||
} | ||
if (options) { | ||
core_1.default.setOptions(options); | ||
} | ||
return nodeCacheAdapter; | ||
@@ -90,0 +96,0 @@ }; |
{ | ||
"name": "@type-cacheable/node-cache-adapter", | ||
"version": "12.0.1", | ||
"version": "13.0.0", | ||
"description": "Adapter for using node-cache with type-cacheable", | ||
@@ -41,3 +41,3 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@type-cacheable/core": "^12.0.1", | ||
"@type-cacheable/core": "^13.0.0", | ||
"node-cache": "^5.0.0", | ||
@@ -50,3 +50,3 @@ "typescript": "^5.0.2" | ||
}, | ||
"gitHead": "a9e89819f76c283904502dbab4c051f5ce9d774e" | ||
"gitHead": "51bce5aa53eb0190529ca308fbeb6ae69c04ef39" | ||
} |
@@ -26,3 +26,3 @@ # @type-cacheable/node-cache-adapter | ||
```ts | ||
import * as NodeCache from 'node-cache'; | ||
import NodeCache from 'node-cache'; | ||
import { useAdapter } from '@type-cacheable/node-cache-adapter'; | ||
@@ -29,0 +29,0 @@ |
Sorry, the diff of this file is not supported yet
10323
3.57%116
5.45%