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

@soundxyz/fine-grained-cache

Package Overview
Dependencies
Maintainers
10
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@soundxyz/fine-grained-cache - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

7

dist/fineGrained.d.ts

@@ -132,3 +132,10 @@ import type { Redis } from "ioredis";

invalidateCache: (keys_0: string, ...keys_1: (string | number)[]) => Promise<void>;
setCache: ({ populateMemoryCache, ttl, keys, useSuperjson, value, }: {
populateMemoryCache: boolean;
ttl: StringValue | "Infinity";
keys: string | [string, ...(string | number)[]];
useSuperjson: boolean;
value: unknown;
}) => Promise<void>;
};
export {};

56

dist/fineGrained.js

@@ -500,2 +500,55 @@ 'use strict';

}
async function setCache({
populateMemoryCache = defaultUseMemoryCache,
ttl,
keys,
useSuperjson,
value
}) {
const key = generateCacheKey(keys);
const expirySeconds = ttl === "Infinity" ? -1 : getExpirySeconds(ttl);
const stringifiedValue = useSuperjson ? superjson__default["default"].stringify(value) : JSON.stringify(value);
if (expirySeconds > 0) {
if (populateMemoryCache)
memoryCache.set(key, value);
if (pipelineRedisSET) {
await pipelinedRedisSet({
key,
value: stringifiedValue,
ttl: expirySeconds
});
} else {
const tracing = enabledLogEvents?.REDIS_SET ? getTracing() : null;
await redis.setex(key, expirySeconds, stringifiedValue).then(() => {
if (tracing) {
logMessage("REDIS_SET", {
key,
expirySeconds,
time: tracing()
});
}
});
}
} else if (ttl === "Infinity") {
if (populateMemoryCache)
memoryCache.set(key, value);
if (pipelineRedisSET) {
await pipelinedRedisSet({
key,
value: stringifiedValue
});
} else {
const tracing = enabledLogEvents?.REDIS_SET ? getTracing() : null;
await redis.set(key, stringifiedValue).then(() => {
if (tracing) {
logMessage("REDIS_SET", {
key,
expirySeconds: "Infinity",
time: tracing()
});
}
});
}
}
}
return {

@@ -506,3 +559,4 @@ getCached,

memoryCache,
invalidateCache
invalidateCache,
setCache
};

@@ -509,0 +563,0 @@ }

2

package.json
{
"name": "@soundxyz/fine-grained-cache",
"version": "2.2.1",
"version": "2.3.0",
"description": "Fine-grained cache helper using redis",

@@ -5,0 +5,0 @@ "keywords": [

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