@mastra/redis 1.1.0 → 1.1.1
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/CHANGELOG.md +58 -0
- package/dist/cache.d.ts +1 -1
- package/dist/cache.d.ts.map +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +10 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +2 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -146,13 +146,16 @@ var StoreMemoryRedis = class extends MemoryStorage {
|
|
|
146
146
|
await this.db.scanAndDelete("msg-idx:*");
|
|
147
147
|
await this.db.scanAndDelete("thread:*:messages");
|
|
148
148
|
}
|
|
149
|
-
async getThreadById({
|
|
149
|
+
async getThreadById({
|
|
150
|
+
threadId,
|
|
151
|
+
resourceId
|
|
152
|
+
}) {
|
|
150
153
|
try {
|
|
151
154
|
const thread = await this.db.get({
|
|
152
155
|
tableName: TABLE_THREADS,
|
|
153
156
|
keys: { id: threadId }
|
|
154
157
|
});
|
|
155
|
-
if (!thread) {
|
|
158
|
+
if (!thread || resourceId !== void 0 && thread.resourceId !== resourceId) {
|
|
156
159
|
return null;
|
|
157
160
|
}
|
|
158
161
|
return {
|
|
@@ -1834,11 +1837,13 @@ var RedisServerCache = class extends MastraServerCache {
|
|
|
1834
1837
|
}
|
|
1835
1838
|
return this.deserialize(value);
|
|
1836
1839
|
}
|
|
1837
|
-
async set(key, value) {
|
|
1840
|
+
async set(key, value, ttlMs) {
|
|
1838
1841
|
const fullKey = this.getKey(key);
|
|
1839
1842
|
const serialized = this.serialize(value);
|
|
1840
|
-
|
|
1841
|
-
|
|
1843
|
+
const overrideSeconds = ttlMs !== void 0 ? Math.max(1, Math.ceil(ttlMs / 1e3)) : void 0;
|
|
1844
|
+
const effectiveSeconds = overrideSeconds ?? this.ttlSeconds;
|
|
1845
|
+
if (effectiveSeconds > 0) {
|
|
1846
|
+
await this.setWithExpiry(this.client, fullKey, serialized, effectiveSeconds);
|
|
1842
1847
|
} else {
|
|
1843
1848
|
await this.client.set(fullKey, serialized);
|
|
1844
1849
|
}
|