-
-
Notifications
You must be signed in to change notification settings - Fork 4
feat: enhance cache invalidation strategy and bump version to 6.34.0 #289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ import Converter from "../../Helper/Converter.helper"; | |
| import FolderManager from "../../engine/Filesystem/FolderManager"; | ||
| import InsertIndex from "../Index/InsertIndex.service"; | ||
| import { IndexCache } from "../Index/IndexCache.service"; | ||
| import InMemoryCache from "../../Memory/memory.operation"; | ||
|
|
||
| /** | ||
| * Represents a collection inside a database. | ||
|
|
@@ -186,10 +187,13 @@ export default class Collection { | |
|
|
||
| // Save the data first | ||
| const saveResult = await this.Insertion.Save(data, documentId); | ||
|
|
||
| // Index insertion after save | ||
| await this.IndexManager.InsertToIndex(data); | ||
|
|
||
|
|
||
| // Fire-and-forget: Invalidate cache asynchronously for faster response | ||
| InMemoryCache.invalidateByDocument(this.path, documentId).catch(() => {}); | ||
|
Comment on lines
+194
to
+195
|
||
|
|
||
| return saveResult; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment says "Invalidate cache asynchronously for faster response", but
invalidateByDocument()/invalidateByCollection()currently contain noawait, so the invalidation work runs synchronously when called. Either adjust the comment to match reality, or explicitly defer the invalidation (with a clear note about any potential staleness tradeoff).