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 0.0.0-20240202084427 to 0.0.0-20240326091405

3

lib/index.d.ts
import type { Logger } from 'pino';
import type { NotUndefined } from 'object-hash';
import type { Backend } from './backend/types';

@@ -15,5 +16,5 @@ import { type Options as RedisCacheOptions } from './backend/redis';

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, cleanup: {
export declare function cached<ARGS extends ReadonlyArray<any>, RESULT>(options: CacheOptions, log: Logger, ttl: number, fn: (...ARGS: ARGS) => Promise<RESULT> | RESULT, keyCreator: (...ARGS: ARGS) => NotUndefined, cleanup: {
addListener(fn: () => Promise<void>): void;
}): (...ARGS: ARGS) => Promise<RESULT>;
export {};

@@ -7,2 +7,3 @@ "use strict";

exports.cached = void 0;
const object_hash_1 = require("object-hash");
const memory_1 = __importDefault(require("./backend/memory"));

@@ -36,3 +37,3 @@ const disabled_1 = __importDefault(require("./backend/disabled"));

const cache = await cacheAsync;
const key = keyCreator ? keyCreator(...args) : JSON.stringify(args);
const key = (0, object_hash_1.sha1)(keyCreator(...args));
let result = await cache.get(key);

@@ -39,0 +40,0 @@ if (!result) {

{
"name": "@axah/cache",
"version": "0.0.0-20240202084427",
"version": "0.0.0-20240326091405",
"description": "Provides a cache either backed by RAM or redis",

@@ -24,3 +24,4 @@ "main": "lib/index.js",

"ts-node": "^10.9.1",
"typescript": "^4.9.4"
"typescript": "^4.9.4",
"@types/object-hash": "^3.0.6"
},

@@ -31,3 +32,4 @@ "peerDependencies": {

"dependencies": {
"redis": "^4.5.1"
"redis": "^4.5.1",
"object-hash": "^3.0.0"
},

@@ -34,0 +36,0 @@ "scripts": {

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