@type-cacheable/lru-cache-adapter
Advanced tools
Comparing version 15.0.0 to 16.0.0
import { LRUCache } from 'lru-cache'; | ||
import { CacheClient } from '@type-cacheable/core'; | ||
import { CacheClient, CacheManagerOptions } from '@type-cacheable/core'; | ||
export declare class LRUCacheAdapter<T extends {}> implements CacheClient { | ||
@@ -13,2 +13,2 @@ constructor(lruClient: LRUCache<string, T>); | ||
} | ||
export declare const useAdapter: <T extends {} = {}>(client: LRUCache<string, T, unknown>, asFallback?: boolean) => LRUCacheAdapter<T>; | ||
export declare const useAdapter: <T extends {} = {}>(client: LRUCache<string, T, unknown>, asFallback?: boolean, options?: CacheManagerOptions) => LRUCacheAdapter<T>; |
@@ -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.LRUCacheAdapter = void 0; | ||
const core_1 = require("@type-cacheable/core"); | ||
const core_1 = __importDefault(require("@type-cacheable/core")); | ||
class LRUCacheAdapter { | ||
@@ -83,3 +86,3 @@ constructor(lruClient) { | ||
exports.LRUCacheAdapter = LRUCacheAdapter; | ||
const useAdapter = (client, asFallback) => { | ||
const useAdapter = (client, asFallback, options) => { | ||
const lruCacheAdapter = new LRUCacheAdapter(client); | ||
@@ -92,2 +95,5 @@ if (asFallback) { | ||
} | ||
if (options) { | ||
core_1.default.setOptions(options); | ||
} | ||
return lruCacheAdapter; | ||
@@ -94,0 +100,0 @@ }; |
{ | ||
"name": "@type-cacheable/lru-cache-adapter", | ||
"version": "15.0.0", | ||
"version": "16.0.0", | ||
"description": "Adapter for using lru-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", | ||
"lru-cache": "^10.0.0", | ||
@@ -50,3 +50,3 @@ "typescript": "^5.0.2" | ||
}, | ||
"gitHead": "2ada92dda969644761167f27f72a2711567eb0eb" | ||
"gitHead": "51bce5aa53eb0190529ca308fbeb6ae69c04ef39" | ||
} |
@@ -29,3 +29,3 @@ # @type-cacheable/lru-cache-adapter | ||
const client = new LRUCache(); | ||
const client = new LRUCache<string, any>(); | ||
const clientAdapter = useAdapter(client); | ||
@@ -32,0 +32,0 @@ ``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10391
111