AshCache.Resource.Verifiers.ValidateCacheBlock (AshCache v0.1.0)

Copy Markdown View Source

Rejects a cache block that names an action of the wrong type, declares the same action twice, refreshes a read it does not cache, or lists in clear_when_changed a module that is not a resource using AshCache. A typo in any of these would silently cache or clear nothing.

Also rejects a cached generic action that returns nothing (there is nothing to cache) or whose run is a Reactor (Ash runs a Reactor itself, so AshCache cannot put itself in front of it).

A cached calculation must exist and be a module calculation with calculate/3. An expression calculation is rejected: it already runs in the database, and cached reads already hold its result.

A resource may cache nothing: it can use the extension only so its writes clear the reads of resources that list it in clear_when_changed.