@knaus94/prisma-extension-cache-manager 1.5.61 → 1.5.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +12 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -196,7 +196,12 @@ exports.default = ({ cache, defaultTTL, debug }) => {
196
196
  ttl = cacheOption.ttl ?? defaultTTL ?? 0;
197
197
  // Сохраняем результат в кеш, используя msgpack5
198
198
  try {
199
- await cache.store.set(cacheKey, serialize(result), ttl);
199
+ if (ttl > 0) {
200
+ await cache.store.client.set(cacheKey, serialize(result), "EX", ttl / 1000);
201
+ }
202
+ else {
203
+ await cache.store.client.set(cacheKey, serialize(result));
204
+ }
200
205
  if (debug) {
201
206
  console.log("Data cached with key (function):", cacheKey, "encoded:", serialize(result), "decoded:", result);
202
207
  }
@@ -249,7 +254,12 @@ exports.default = ({ cache, defaultTTL, debug }) => {
249
254
  // 6. Сохраняем результат запроса в кеш
250
255
  try {
251
256
  const data = serialize(result);
252
- await cache.store.set(cacheKey, data, ttl);
257
+ if (ttl > 0) {
258
+ await cache.store.client.set(cacheKey, data, "EX", ttl / 1000);
259
+ }
260
+ else {
261
+ await cache.store.client.set(cacheKey, data);
262
+ }
253
263
  if (debug) {
254
264
  console.log("Data cached with key:", cacheKey, "encoded:", data, "decoded:", result);
255
265
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knaus94/prisma-extension-cache-manager",
3
- "version": "1.5.61",
3
+ "version": "1.5.62",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/knaus94/prisma-extension-cache-manager.git"