View Source Carve.Batch (Carve v0.6.0)

Batched cache warm-up for views that define cache_many.

warm/3 resolves the cached value for a set of entities of one view in a single __cache_many__/1 call, instead of one __cache__/1 call per entity. Views without cache_many fall back to the per-entity path, preserving the existing cache behavior exactly.

Summary

Functions

Whether the view module declares cache_many.

Returns a map of entity id => cached value for every entity in items, warming the request cache along the way.

Functions

Whether the view module declares cache_many.

Link to this function

warm(module, items, cache_key)

View Source

Returns a map of entity id => cached value for every entity in items, warming the request cache along the way.

For a view with cache_many, entities already present in the request cache are excluded from the batch call; ids missing from the returned map are cached as nil. Batching also works when caching is disabled (cache_key is nil): the batch still runs once and the results are returned directly.