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

@axah/cache

Package Overview
Dependencies
Maintainers
11
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axah/cache - npm Package Compare versions

Comparing version 4.0.0 to 5.0.0

3

lib/backend/disabled.js

@@ -17,2 +17,5 @@ "use strict";

},
async cleanup() {
// no-op
},
};

@@ -19,0 +22,0 @@ }

@@ -30,2 +30,8 @@ "use strict";

},
async cleanup() {
for (const [, entry] of cache) {
clearTimeout(entry.timeout);
}
cache.clear();
},
};

@@ -32,0 +38,0 @@ }

@@ -42,2 +42,5 @@ "use strict";

},
async cleanup() {
await client.quit();
},
};

@@ -44,0 +47,0 @@ }

@@ -5,2 +5,3 @@ export type Backend = {

delete(key: string): Promise<void>;
cleanup(): Promise<void>;
};

4

lib/index.d.ts

@@ -15,3 +15,5 @@ import type { Logger } from 'pino';

export default function createCache(options: CacheOptions, log: Logger): Promise<Backend>;
export declare function cached<ARGS extends ReadonlyArray<any>, RESULT>(options: CacheOptions, log: Logger, ttl: number, fn: (...ARGS: ARGS) => Promise<RESULT> | RESULT, keyCreator: (...ARGS: ARGS) => string): (...ARGS: ARGS) => Promise<RESULT>;
export declare function cached<ARGS extends ReadonlyArray<any>, RESULT>(options: CacheOptions, log: Logger, ttl: number, fn: (...ARGS: ARGS) => Promise<RESULT> | RESULT, keyCreator: (...ARGS: ARGS) => string, cleanup: {
addListener(fn: () => Promise<void>): void;
}): (...ARGS: ARGS) => Promise<RESULT>;
export {};

@@ -25,6 +25,10 @@ "use strict";

exports.default = createCache;
function cached(options, log, ttl, fn, keyCreator) {
function cached(options, log, ttl, fn, keyCreator, cleanup) {
const cacheAsync = createCache(options, log);
// eslint-disable-next-line @typescript-eslint/no-empty-function
cacheAsync.catch(() => { }); // prevent unhandled promise rejection...
cleanup.addListener(async () => {
const cache = await cacheAsync;
await cache.cleanup();
});
return async function doCached(...args) {

@@ -31,0 +35,0 @@ const cache = await cacheAsync;

{
"name": "@axah/cache",
"version": "4.0.0",
"version": "5.0.0",
"description": "Provides a cache either backed by RAM or redis",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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