Repository navigation
cacheable - fix: size each key value in deleteMany stats #1742
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 |
|---|---|---|
|
|
@@ -1155,10 +1155,17 @@ export class Cacheable extends Hookified { | |
| const primaryBackfillBarrier = this.cancelPrimaryBackfills(keys); | ||
| await primaryBackfillBarrier; | ||
| if (this.stats.enabled) { | ||
| const statResult = (await this._primary.get(keys)) as unknown; | ||
| for (const key of keys) { | ||
| // Use the raw entries, because a cached value can be undefined. | ||
| const statResults = await this._primary.getManyRaw<unknown>(keys); | ||
| for (const [index, key] of keys.entries()) { | ||
| // Skip a key that is not in the cache. Size only the value of this key. | ||
| const statResult = statResults[index]; | ||
| if (statResult === undefined) { | ||
| continue; | ||
|
Comment on lines
+1163
to
+1164
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the primary copy expires before the secondary copy, Useful? React with 👍 / 👎.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not change this in this PR. These are the reasons:
A stats model for two layers is a different issue from #1738. I leave this thread open for the maintainer. Generated by Claude Code |
||
| } | ||
|
|
||
| this.stats.decreaseKSize(key); | ||
| this.stats.decreaseVSize(statResult); | ||
| this.stats.decreaseVSize(statResult.value); | ||
| this.stats.decreaseCount(); | ||
| this.stats.incrementDeletes(); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.