@memberjunction/core 5.48.0 → 5.50.0
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/dist/generic/RegisterForStartup.d.ts +78 -1
- package/dist/generic/RegisterForStartup.d.ts.map +1 -1
- package/dist/generic/RegisterForStartup.js +108 -7
- package/dist/generic/RegisterForStartup.js.map +1 -1
- package/dist/generic/baseEntity.d.ts +5 -0
- package/dist/generic/baseEntity.d.ts.map +1 -1
- package/dist/generic/baseEntity.js +76 -4
- package/dist/generic/baseEntity.js.map +1 -1
- package/dist/generic/compositeKey.d.ts.map +1 -1
- package/dist/generic/compositeKey.js +8 -1
- package/dist/generic/compositeKey.js.map +1 -1
- package/dist/generic/localCacheManager.d.ts +199 -7
- package/dist/generic/localCacheManager.d.ts.map +1 -1
- package/dist/generic/localCacheManager.js +439 -26
- package/dist/generic/localCacheManager.js.map +1 -1
- package/dist/generic/permissionInterfaces.d.ts +11 -0
- package/dist/generic/permissionInterfaces.d.ts.map +1 -1
- package/dist/generic/permissionInterfaces.js +13 -2
- package/dist/generic/permissionInterfaces.js.map +1 -1
- package/dist/generic/providerBase.d.ts +87 -4
- package/dist/generic/providerBase.d.ts.map +1 -1
- package/dist/generic/providerBase.js +312 -52
- package/dist/generic/providerBase.js.map +1 -1
- package/dist/generic/util.d.ts.map +1 -1
- package/dist/generic/util.js +6 -0
- package/dist/generic/util.js.map +1 -1
- package/dist/views/runView.d.ts +1 -1
- package/dist/views/runView.d.ts.map +1 -1
- package/dist/views/runView.js +18 -3
- package/dist/views/runView.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseSingleton } from "@memberjunction/global";
|
|
2
2
|
import { AggregateResult, DatasetItemFilterType, DatasetResultType, IMetadataProvider, ILocalStorageProvider } from "./interfaces.js";
|
|
3
|
-
import { RunViewParams } from "../views/runView.js";
|
|
3
|
+
import { AggregateExpression, RunViewParams } from "../views/runView.js";
|
|
4
4
|
import { BaseEntityEvent } from "./baseEntity.js";
|
|
5
5
|
import { CompositeKey } from "./compositeKey.js";
|
|
6
6
|
/**
|
|
@@ -95,6 +95,13 @@ export interface CachedRunViewResult {
|
|
|
95
95
|
aggregateResults?: AggregateResult[];
|
|
96
96
|
/** Total row count from the database — may differ from rowCount for paginated queries */
|
|
97
97
|
totalRowCount?: number;
|
|
98
|
+
/**
|
|
99
|
+
* Schema fingerprint captured when these rows were cached, surfaced from the stored payload
|
|
100
|
+
* so in-place maintenance can carry it FORWARD when rewriting the slot (B38). Without it the
|
|
101
|
+
* rewrite drops the hash, and `isSchemaStaleCacheEntry` short-circuits on a missing hash —
|
|
102
|
+
* permanently disabling post-migration drift detection for that slot.
|
|
103
|
+
*/
|
|
104
|
+
schemaHash?: string;
|
|
98
105
|
}
|
|
99
106
|
/**
|
|
100
107
|
* Configuration for the LocalCacheManager
|
|
@@ -114,6 +121,17 @@ export interface LocalCacheManagerConfig {
|
|
|
114
121
|
* entries for that entity are evicted. Default: 50. Set to 0 to disable.
|
|
115
122
|
*/
|
|
116
123
|
maxPercentOfCachePerEntity: number;
|
|
124
|
+
/**
|
|
125
|
+
* Maximum size of any single cache entry, expressed as a percentage of
|
|
126
|
+
* maxSizeBytes. An entry estimated larger than this cap is not cached at
|
|
127
|
+
* all — the write is skipped (logged, data still returned to the caller
|
|
128
|
+
* uncached). Without this cap, storing an oversized entry is strictly worse
|
|
129
|
+
* than not caching it: evictIfNeeded frees max(incoming, 10% of budget), so
|
|
130
|
+
* an entry larger than the whole budget evicts EVERY other entry and still
|
|
131
|
+
* cannot be retained within budget — a full cache wipe on every store.
|
|
132
|
+
* Applies to RunView and RunQuery entries. Default: 25. Set to 0 to disable.
|
|
133
|
+
*/
|
|
134
|
+
maxEntryPercentOfCache: number;
|
|
117
135
|
/**
|
|
118
136
|
* Interval in milliseconds for the periodic eviction sweep.
|
|
119
137
|
* Catches entries that should have been evicted (TTL expired) but weren't
|
|
@@ -301,7 +319,11 @@ export declare class LocalCacheManager extends BaseSingleton<LocalCacheManager>
|
|
|
301
319
|
SetStorageProvider(newProvider: ILocalStorageProvider): Promise<void>;
|
|
302
320
|
/**
|
|
303
321
|
* Extracts the entity name from a RunView fingerprint.
|
|
304
|
-
* Fingerprint format: `
|
|
322
|
+
* Fingerprint format: `Entity|Filter|OrderBy|MaxRows|StartRow|AggHash|UserSearch[|…]`
|
|
323
|
+
* (built in GenerateRunViewFingerprint below — that array is the ground truth). NOTE:
|
|
324
|
+
* `ResultType` is deliberately NOT a segment; the cache stores plain JSON regardless and
|
|
325
|
+
* transformation happens post-cache. An earlier version of this comment listed it, which
|
|
326
|
+
* would put any new segment-indexing predicate one position off — MaxRows is [3], not [4].
|
|
305
327
|
* @param fingerprint - The RunView cache fingerprint
|
|
306
328
|
* @returns The entity name, or null if the fingerprint is malformed
|
|
307
329
|
*/
|
|
@@ -313,6 +335,131 @@ export declare class LocalCacheManager extends BaseSingleton<LocalCacheManager>
|
|
|
313
335
|
* @param fingerprint - The RunView cache fingerprint
|
|
314
336
|
*/
|
|
315
337
|
protected isFilteredFingerprint(fingerprint: string): boolean;
|
|
338
|
+
/**
|
|
339
|
+
* Returns true if the slot was cached under an ORDER BY (fingerprint segment [2]).
|
|
340
|
+
*
|
|
341
|
+
* An ordered slot's row SET can be maintained in place, but its ORDER cannot: an upsert
|
|
342
|
+
* appends the new row at map-insertion end and leaves re-sorted rows at their old positions,
|
|
343
|
+
* so the slot silently stops honoring the order the caller asked for — wrong for any
|
|
344
|
+
* "first row of the ordered set" consumer. Re-sorting in JS would require reimplementing SQL
|
|
345
|
+
* ORDER BY semantics (collations, NULL ordering, expression sorts), which is exactly the kind
|
|
346
|
+
* of "derive it in JS" shortcut this file keeps having to walk back.
|
|
347
|
+
*
|
|
348
|
+
* DELETE remains maintainable: removing a row preserves the relative order of the rest. This
|
|
349
|
+
* mirrors the filtered-slot asymmetry, and the branch order in
|
|
350
|
+
* processEntityEventForFingerprint (delete is checked before the filtered classification)
|
|
351
|
+
* delivers it without extra wiring. `BaseEngine` already refuses ordered configs for
|
|
352
|
+
* in-place mutation (`canUseImmediateMutation`); this closes the same gap in the raw
|
|
353
|
+
* provider cache. (B42)
|
|
354
|
+
*
|
|
355
|
+
* @param parts - the fingerprint already split on '|'
|
|
356
|
+
*/
|
|
357
|
+
protected hasOrderBy(parts: string[]): boolean;
|
|
358
|
+
/**
|
|
359
|
+
* Returns true if the slot was produced by a user search (fingerprint segment [6]).
|
|
360
|
+
*
|
|
361
|
+
* `UserSearchString` generates LIKE / full-text WHERE clauses, so it narrows rows exactly as
|
|
362
|
+
* `ExtraFilter` does — but it lives at index [6], INSIDE the 7-segment base, where neither the
|
|
363
|
+
* `parts[1]` filter check nor `hasNarrowingSegment` (which starts at index 7) was looking.
|
|
364
|
+
*
|
|
365
|
+
* Same bug class as H1/H3, different hiding place: a row-narrowing predicate invisible to the
|
|
366
|
+
* maintainability check. Demonstrated by upserting a non-matching row into a search slot —
|
|
367
|
+
* a search for "annual gala" subsequently served "Totally Unrelated Row". Explorer grid
|
|
368
|
+
* searches are the reachable surface. (N1)
|
|
369
|
+
*
|
|
370
|
+
* @param parts - the fingerprint already split on '|'
|
|
371
|
+
*/
|
|
372
|
+
protected hasUserSearch(parts: string[]): boolean;
|
|
373
|
+
/**
|
|
374
|
+
* Returns true if the slot carries aggregate results (fingerprint segment [5], `aggHash`).
|
|
375
|
+
*
|
|
376
|
+
* ## Why an aggregate slot must be INVALIDATED, not maintained (H2)
|
|
377
|
+
* The aggregate was computed by the DATABASE over the pre-mutation row set. After an in-place
|
|
378
|
+
* upsert/remove there is no way to recompute it in JS for the general case: `COUNT(*)` shifts
|
|
379
|
+
* by one, `SUM`/`AVG` need the mutated row's contribution to the specific expression, and
|
|
380
|
+
* `MAX`/`MIN` may or may not move depending on the value.
|
|
381
|
+
*
|
|
382
|
+
* The first attempt at this fix CARRIED the cached aggregate forward — which was worse than
|
|
383
|
+
* the bug it replaced. Verified live: after a save the slot reported `rows=7` alongside
|
|
384
|
+
* `COUNT(*) = 6`. A caller can detect a MISSING aggregate; it cannot detect a stale one, and
|
|
385
|
+
* the read path reports `Success: true` / `cacheStatus: 'hit'` either way. Silently wrong
|
|
386
|
+
* beats loudly absent only if you never look.
|
|
387
|
+
*
|
|
388
|
+
* So: same treatment as subset slots. The value is not derivable in JS, therefore the slot is
|
|
389
|
+
* dropped and the next read recomputes it against the database.
|
|
390
|
+
*
|
|
391
|
+
* @param parts - the fingerprint already split on '|'
|
|
392
|
+
*/
|
|
393
|
+
protected hasAggregates(parts: string[]): boolean;
|
|
394
|
+
/**
|
|
395
|
+
* Returns true if the fingerprint carries any segment BEYOND the 7-part base that narrows the
|
|
396
|
+
* result set — i.e. the slot holds fewer rows than an unfiltered read of the same entity would.
|
|
397
|
+
*
|
|
398
|
+
* ## Why this exists (H1/H3)
|
|
399
|
+
* The base fingerprint is `Entity|Filter|OrderBy|MaxRows|StartRow|AggHash|UserSearch`, and the
|
|
400
|
+
* original filtered-check inspected ONLY `parts[1]`. But two later segments narrow the rows
|
|
401
|
+
* WITHOUT touching that segment:
|
|
402
|
+
*
|
|
403
|
+
* - `vw:<id>` — a saved view's `WhereClause` lives ON THE VIEW, not in `params.ExtraFilter`,
|
|
404
|
+
* so the filter segment stays `_`. The slot was therefore classified
|
|
405
|
+
* unfiltered and UPSERTED IN PLACE on save — serving rows the view's own
|
|
406
|
+
* WhereClause excludes. Views are how users are shown a restricted row set,
|
|
407
|
+
* so this reads as a data/permission leak, not merely stale data.
|
|
408
|
+
* - `rls:<h>` — the per-user Row-Level-Security predicate is appended AFTER the filter
|
|
409
|
+
* segment is built. Same misclassification, worse consequence: a save by
|
|
410
|
+
* user A was upserted into user B's RLS-scoped slot, injecting a row B's
|
|
411
|
+
* predicate excludes. That is an RLS bypass.
|
|
412
|
+
*
|
|
413
|
+
* ## Why it is written as a DENY-by-default allowlist
|
|
414
|
+
* Enumerating the narrowing segments would repeat the original mistake: the next segment
|
|
415
|
+
* someone appends is silently treated as maintainable until it causes a leak. So this
|
|
416
|
+
* enumerates only what is provably SAFE and treats everything else as narrowing:
|
|
417
|
+
*
|
|
418
|
+
* - `imr:1` — IgnoreMaxRows WIDENS the set (it removes a cap), so in-place maintenance
|
|
419
|
+
* remains valid.
|
|
420
|
+
* - connection — the `<driver>://host:port/` suffix is slot IDENTITY, not a predicate.
|
|
421
|
+
*
|
|
422
|
+
* Anything else — present or future — falls through to "narrowing", and the slot is
|
|
423
|
+
* conservatively invalidated on mutation rather than maintained. A new segment can therefore
|
|
424
|
+
* cost a cache refill, but it can never silently serve the wrong rows.
|
|
425
|
+
*
|
|
426
|
+
* @param parts - the fingerprint already split on '|'
|
|
427
|
+
*/
|
|
428
|
+
protected hasNarrowingSegment(parts: string[]): boolean;
|
|
429
|
+
/**
|
|
430
|
+
* Returns true if the fingerprint identifies a **subset slot** — a cache entry whose rows are
|
|
431
|
+
* a TRUNCATION (`MaxRows`) or an OFFSET WINDOW (`StartRow`) of the matching set rather than
|
|
432
|
+
* the complete set.
|
|
433
|
+
*
|
|
434
|
+
* Subset slots are safe to STORE and SERVE (a cold read of the slot is exactly what the DB
|
|
435
|
+
* would have returned), but they must NEVER be maintained in place by the BaseEntity
|
|
436
|
+
* save/delete event path:
|
|
437
|
+
*
|
|
438
|
+
* - **Save/upsert** appends the saved row to the slot, so a `MaxRows: 1` slot grows to 2, 3,
|
|
439
|
+
* 4 … rows — silently violating the caller's own row limit and serving a set that is
|
|
440
|
+
* neither the first-N nor the full set (one arbitrary original row plus every locally
|
|
441
|
+
* saved row).
|
|
442
|
+
* - **Delete/remove** shrinks the slot below the limit, so a `MaxRows: 1` slot serves 0 rows
|
|
443
|
+
* while the DB still has 47 matching rows to choose a TOP 1 from.
|
|
444
|
+
*
|
|
445
|
+
* Neither can be repaired in JS: deciding whether a newly saved row belongs *inside* the
|
|
446
|
+
* window, and which row it would displace, requires re-running the query's TOP/OFFSET against
|
|
447
|
+
* the database. So we treat subset slots exactly as filtered slots are treated on save —
|
|
448
|
+
* conservatively INVALIDATE and let the next read repopulate from the DB.
|
|
449
|
+
*
|
|
450
|
+
* This is the row-level counterpart to the `totalRowCount` subset-slot handling: the total is
|
|
451
|
+
* maintained across the delta because the DB total is knowable; the ROWS are not, so the slot
|
|
452
|
+
* is dropped instead.
|
|
453
|
+
*
|
|
454
|
+
* Fingerprint format: `Entity|Filter|OrderBy|MaxRows|StartRow|AggHash|UserSearch[|…]`.
|
|
455
|
+
* Parsing is deliberately conservative — if the segments aren't cleanly numeric (e.g. a filter
|
|
456
|
+
* value containing a literal `|` shifts the positions), we return false and preserve existing
|
|
457
|
+
* behavior rather than over-invalidating. Such a fingerprint is filtered by definition, and
|
|
458
|
+
* filtered slots are already invalidated on save.
|
|
459
|
+
*
|
|
460
|
+
* @param fingerprint - The RunView cache fingerprint
|
|
461
|
+
*/
|
|
462
|
+
protected isSubsetFingerprint(fingerprint: string): boolean;
|
|
316
463
|
/**
|
|
317
464
|
* Checks whether a cached RunView entry is structurally stale due to a schema change
|
|
318
465
|
* (e.g., new columns added via migration + CodeGen). Compares the stored schema hash
|
|
@@ -505,7 +652,11 @@ export declare class LocalCacheManager extends BaseSingleton<LocalCacheManager>
|
|
|
505
652
|
* Generates a human-readable cache fingerprint for a RunView request.
|
|
506
653
|
* This fingerprint uniquely identifies the query based on its parameters and connection.
|
|
507
654
|
*
|
|
508
|
-
* Format:
|
|
655
|
+
* Format: Entity|Filter|OrderBy|MaxRows|StartRow|AggHash|UserSearch[|appended…][|connection]
|
|
656
|
+
* (the parts array below is the ground truth). NOTE: resultType is NOT a segment — an older
|
|
657
|
+
* version of this comment listed it, which put every index after [2] off by one; that exact
|
|
658
|
+
* off-by-one trap has already bitten a segment-indexing predicate once (see the note on
|
|
659
|
+
* extractEntityFromFingerprint).
|
|
509
660
|
* Example: Users|Active=1|Name ASC|simple|100|0|a1b2c3d4|localhost
|
|
510
661
|
*
|
|
511
662
|
* @param params - The RunView parameters
|
|
@@ -526,6 +677,23 @@ export declare class LocalCacheManager extends BaseSingleton<LocalCacheManager>
|
|
|
526
677
|
* @returns A hash string, or '_' if no aggregates
|
|
527
678
|
*/
|
|
528
679
|
private generateAggregateHash;
|
|
680
|
+
/**
|
|
681
|
+
* Reorders cached AggregateResults to match the CALLER's requested Aggregates[] order.
|
|
682
|
+
*
|
|
683
|
+
* The aggregate fingerprint (see {@link generateAggregateHash}) is deliberately
|
|
684
|
+
* order-insensitive — it sorts the aggregates — so two semantically-identical views
|
|
685
|
+
* requested as [A,B] and [B,A] share a single cache slot (cache-efficient). But the
|
|
686
|
+
* {@link RunViewResult.AggregateResults} contract is "in same order as input Aggregates
|
|
687
|
+
* array" — PER caller. A slot warmed as [A,B] therefore hands a [B,A] caller its results
|
|
688
|
+
* in the wrong order unless we remap on the way out. This does that remap.
|
|
689
|
+
*
|
|
690
|
+
* Matching is by (expression, effective alias) — the same identity that produced the
|
|
691
|
+
* aggHash (a result's alias defaults to its expression when the request omitted one).
|
|
692
|
+
* Fail-safe: returns the input unchanged when there are no aggregates to reorder, the
|
|
693
|
+
* counts differ, or any aggregate can't be matched — so a remap is never able to drop or
|
|
694
|
+
* fabricate a result.
|
|
695
|
+
*/
|
|
696
|
+
ReorderAggregateResultsToRequest(cachedResults: AggregateResult[] | undefined, requestedAggregates: AggregateExpression[] | undefined): AggregateResult[] | undefined;
|
|
529
697
|
/**
|
|
530
698
|
* Simple hash function for creating short fingerprints from strings.
|
|
531
699
|
* Not cryptographic, just for deduplication/fingerprinting purposes.
|
|
@@ -625,13 +793,16 @@ export declare class LocalCacheManager extends BaseSingleton<LocalCacheManager>
|
|
|
625
793
|
* @param deletedRecordIDs - Record IDs (in CompositeKey concatenated string format) that have been deleted
|
|
626
794
|
* @param primaryKeyFieldName - The name of the primary key field (or first PK field for composite keys)
|
|
627
795
|
* @param newMaxUpdatedAt - The new maxUpdatedAt timestamp after applying the delta
|
|
628
|
-
* @param
|
|
796
|
+
* @param serverRowCount - The database's authoritative total row count (fresh COUNT(*) over the
|
|
797
|
+
* view) from the smart-cache check. Used as the merged entry's `totalRowCount` when it exceeds
|
|
798
|
+
* the cached slice size — this keeps paginated / MaxRows-limited slots from undercounting the
|
|
799
|
+
* true total. The visible `rowCount` is still derived from the merged results length.
|
|
629
800
|
* @param aggregateResults - Optional fresh aggregate results (since aggregates can't be differentially computed)
|
|
630
801
|
* @param provider - The IMetadataProvider that produced these results (for AllowCaching gating
|
|
631
802
|
* in multi-provider scenarios). Falls back to global Metadata.Provider when omitted.
|
|
632
803
|
* @returns The merged results after applying the differential update, or null if cache not found
|
|
633
804
|
*/
|
|
634
|
-
ApplyDifferentialUpdate(fingerprint: string, params: RunViewParams, updatedRows: unknown[], deletedRecordIDs: string[], primaryKeyFieldName: string, newMaxUpdatedAt: string,
|
|
805
|
+
ApplyDifferentialUpdate(fingerprint: string, params: RunViewParams, updatedRows: unknown[], deletedRecordIDs: string[], primaryKeyFieldName: string, newMaxUpdatedAt: string, serverRowCount?: number, aggregateResults?: AggregateResult[], provider?: IMetadataProvider): Promise<CachedRunViewResult | null>;
|
|
635
806
|
/**
|
|
636
807
|
* Upserts a single entity in a cached RunView result.
|
|
637
808
|
* Used by BaseEngine for immediate cache sync when an entity is saved.
|
|
@@ -665,6 +836,16 @@ export declare class LocalCacheManager extends BaseSingleton<LocalCacheManager>
|
|
|
665
836
|
/**
|
|
666
837
|
* Stores updated results array back to the cache and updates the registry.
|
|
667
838
|
* Shared by UpsertSingleEntity and RemoveSingleEntity to avoid duplication.
|
|
839
|
+
*
|
|
840
|
+
* `prior` carries the pre-mutation total + row count so `totalRowCount` (the DATABASE
|
|
841
|
+
* total) is MAINTAINED across the in-place add/remove rather than dropped. Dropping it
|
|
842
|
+
* made reads fall back to `results.length`, which for a paginated / MaxRows-limited slot
|
|
843
|
+
* is only a SUBSET of the rows — so after the first save/delete event the slot's total
|
|
844
|
+
* collapsed to the cached slice size, undercounting the true total. That is the RunView
|
|
845
|
+
* TotalRowCount discrepancy where a fresh `count_only` reported a larger count than a
|
|
846
|
+
* cached paginated read. We adjust the prior total by the net row delta (add/remove) so a
|
|
847
|
+
* full-dataset slot is unchanged (prior total == prior length) while a subset slot keeps a
|
|
848
|
+
* correct total.
|
|
668
849
|
*/
|
|
669
850
|
private storeCachedResults;
|
|
670
851
|
/**
|
|
@@ -686,7 +867,7 @@ export declare class LocalCacheManager extends BaseSingleton<LocalCacheManager>
|
|
|
686
867
|
* @param connectionPrefix - Prefix identifying the connection (e.g., server URL) to differentiate caches across connections
|
|
687
868
|
* @returns A unique, human-readable fingerprint string
|
|
688
869
|
*/
|
|
689
|
-
GenerateRunQueryFingerprint(queryId?: string, queryName?: string, parameters?: Record<string, unknown>, connectionPrefix?: string): string;
|
|
870
|
+
GenerateRunQueryFingerprint(queryId?: string, queryName?: string, parameters?: Record<string, unknown>, connectionPrefix?: string, categoryPath?: string): string;
|
|
690
871
|
/**
|
|
691
872
|
* Stores a RunQuery result in the cache.
|
|
692
873
|
*
|
|
@@ -698,7 +879,7 @@ export declare class LocalCacheManager extends BaseSingleton<LocalCacheManager>
|
|
|
698
879
|
* @param queryId - Optional query ID for reference
|
|
699
880
|
* @param ttlMs - Optional TTL in milliseconds (for cache expiry tracking)
|
|
700
881
|
*/
|
|
701
|
-
SetRunQueryResult(fingerprint: string, queryName: string, results: unknown[], maxUpdatedAt: string, rowCount?: number, queryId?: string, ttlMs?: number): Promise<void>;
|
|
882
|
+
SetRunQueryResult(fingerprint: string, queryName: string, results: unknown[], maxUpdatedAt: string, rowCount?: number, queryId?: string, ttlMs?: number, warmedForUserID?: string): Promise<void>;
|
|
702
883
|
/**
|
|
703
884
|
* Retrieves a cached RunQuery result.
|
|
704
885
|
*
|
|
@@ -710,6 +891,8 @@ export declare class LocalCacheManager extends BaseSingleton<LocalCacheManager>
|
|
|
710
891
|
maxUpdatedAt: string;
|
|
711
892
|
rowCount: number;
|
|
712
893
|
queryId?: string;
|
|
894
|
+
/** User who executed the authorized miss that produced this slot (B43 tie-breaker). */
|
|
895
|
+
warmedForUserID?: string;
|
|
713
896
|
} | null>;
|
|
714
897
|
/**
|
|
715
898
|
* Invalidates a cached RunQuery result.
|
|
@@ -820,6 +1003,15 @@ export declare class LocalCacheManager extends BaseSingleton<LocalCacheManager>
|
|
|
820
1003
|
* Sample size = clamp(ceil(rowCount × 10%), 3, 10); rows ≤ 3 are measured in full; 0 → 0.
|
|
821
1004
|
*/
|
|
822
1005
|
private estimateResultsSize;
|
|
1006
|
+
/**
|
|
1007
|
+
* Returns true when a single entry of the given estimated size exceeds the
|
|
1008
|
+
* per-entry cap (maxEntryPercentOfCache of maxSizeBytes) and must not be
|
|
1009
|
+
* cached. See the config property's doc comment for the full rationale —
|
|
1010
|
+
* in short, an entry that large can only be stored by evicting most (or
|
|
1011
|
+
* all) of the cache, and it would be evicted again on the next store, so
|
|
1012
|
+
* caching it is strictly worse than skipping it.
|
|
1013
|
+
*/
|
|
1014
|
+
private exceedsMaxEntrySize;
|
|
823
1015
|
/**
|
|
824
1016
|
* Evicts entries if needed to make room for new data.
|
|
825
1017
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localCacheManager.d.ts","sourceRoot":"","sources":["../../src/generic/localCacheManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAyB,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACnI,OAAO,
|
|
1
|
+
{"version":3,"file":"localCacheManager.d.ts","sourceRoot":"","sources":["../../src/generic/localCacheManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAyB,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACnI,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,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