Builds deterministic cache keys for cached read and generic actions.
A key is a plain Erlang term (no hashing, so no collision risk) built from:
- the resource module
- the resource's current cache version (see
AshCache.CacheVersion) - the action name
- the whole query shape — arguments,
filter,sort,limit,offset,page,distinct,select,load,calculationsandaggregates(assembled inAshCache.Preparations.ReadThrough).filteris the load-bearing one: the policy authorizer has already folded its filter checks into it by the time the key is derived, so it is what stops an unauthorized read from being answered by an authorized one — not merely what tells two queries apart - for a generic action, only its arguments take the place of the query
shape (
AshCache.Actions.RunThrough) - for a calculation,
{:calculation, name}takes the place of the action name, and the shape is one record's attributes, the fields the calculation loads and its arguments (AshCache.Calculations.CalculateThrough); there is no version - the actor and tenant, so cached results never leak across actors or tenants