Which other resources a read's result was computed from.
A cached entry is cleared by writes to its own resource and to the
resources in clear_when_changed, so a result may only be cached when
everything it was computed from is among them. Rows can depend on other
resources through:
- the filter, including the filter a policy adds (
exists(team.members, ...)) - the sort and distinct, when they use an aggregate or a calculation
- loaded aggregates, such as a count of comments
- loaded calculations the data layer computed, such as an expression over an aggregate
Each relationship on such a path counts, and so does the join resource of a
many_to_many: a new join row changes the result as much as a new related
row does. Comparing only a belongs_to's key, as relates_to_actor_via
does, reads the foreign key on the row itself and does not count.
Related records loaded with load: :comments do not count. Ash reads them
after the cached rows on every read, cache hit or not, so they are never
stale.
Summary
Functions
Whether every resource records were computed from is query's own
resource or one of clear_when_changed.
The resources query reaches through relationships to compute records,
or :unknown when a loaded value cannot be traced back to a definition.
Functions
@spec all_known?(Ash.Query.t(), [Ash.Resource.record()], [module()]) :: boolean()
Whether every resource records were computed from is query's own
resource or one of clear_when_changed.
@spec resources(Ash.Query.t(), [Ash.Resource.record()]) :: {:ok, [module()]} | :unknown
The resources query reaches through relationships to compute records,
or :unknown when a loaded value cannot be traced back to a definition.