shuttlepro-shared 1.1.77 → 1.1.79
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.
- package/config/redis.js +6 -4
- package/package.json +1 -1
package/config/redis.js
CHANGED
|
@@ -81,7 +81,9 @@ const setRedisData = async (
|
|
|
81
81
|
await connectRedis();
|
|
82
82
|
let result;
|
|
83
83
|
if (field) {
|
|
84
|
-
result = await client.hSet(key, field, JSON.stringify(value)
|
|
84
|
+
result = await client.hSet(key, field, JSON.stringify(value), {
|
|
85
|
+
EX: expiryInSeconds,
|
|
86
|
+
});
|
|
85
87
|
} else {
|
|
86
88
|
result = await client.set(key, JSON.stringify(value), {
|
|
87
89
|
EX: expiryInSeconds,
|
|
@@ -90,7 +92,7 @@ const setRedisData = async (
|
|
|
90
92
|
return result;
|
|
91
93
|
} catch (err) {
|
|
92
94
|
console.error("❌ Error setting Redis data:", err);
|
|
93
|
-
|
|
95
|
+
return null;
|
|
94
96
|
}
|
|
95
97
|
};
|
|
96
98
|
|
|
@@ -106,7 +108,7 @@ const getRedisData = async (key, field = null) => {
|
|
|
106
108
|
return result ? JSON.parse(result) : null;
|
|
107
109
|
} catch (err) {
|
|
108
110
|
console.error("❌ Error getting Redis data:", err);
|
|
109
|
-
|
|
111
|
+
return null;
|
|
110
112
|
}
|
|
111
113
|
};
|
|
112
114
|
|
|
@@ -121,7 +123,7 @@ const deleteRedisData = async (key, field = null) => {
|
|
|
121
123
|
return field ? await client.hDel(key, field) : await client.del(key);
|
|
122
124
|
} catch (err) {
|
|
123
125
|
console.error("❌ Error deleting Redis data:", err);
|
|
124
|
-
|
|
126
|
+
return null;
|
|
125
127
|
}
|
|
126
128
|
};
|
|
127
129
|
|