Memoizes the item of each resolved value for the life of the source, so a
department shown in twenty rows and on every page is asked once: a
resolve sends the inner source only the values it has never seen, a
value being resolved is shared by every caller asking for it meanwhile, a
value the inner source does not return is remembered as missing, and a
rejected resolution is forgotten, so the next call tries again.
ICachedLookupSource.invalidate forgets entries by hand. search
and valueOf are untouched.
Signal. The call of the inner source runs without a signal: its result
fills the cache even for a caller that no longer wants it, and one
caller's abort must not starve the others sharing the resolution. The
aborted caller alone rejects with AbortedException, at once.
Compose it outside withBatching, withCache(withBatching(source)):
the misses of the cache are what the batch coalesces.
a source with the same contract, caching resolve, plus invalidate.
Example
constdepartments = withCache(withBatching(createLookupSource(readDepartments, { textField:"name", valueField:"id" }))); awaitdepartments.resolve([1, 2]); // one request awaitdepartments.resolve([2, 3]); // one request, for 3 only departments.invalidate([2]); // 2 is asked again next time
Memoizes the item of each resolved value for the life of the source, so a department shown in twenty rows and on every page is asked once: a
resolvesends the inner source only the values it has never seen, a value being resolved is shared by every caller asking for it meanwhile, a value the inner source does not return is remembered as missing, and a rejected resolution is forgotten, so the next call tries again. ICachedLookupSource.invalidate forgets entries by hand.searchandvalueOfare untouched.Signal. The call of the inner source runs without a signal: its result fills the cache even for a caller that no longer wants it, and one caller's abort must not starve the others sharing the resolution. The aborted caller alone rejects with
AbortedException, at once.Compose it outside withBatching,
withCache(withBatching(source)): the misses of the cache are what the batch coalesces.