# `AshCache.Resource.Transformers.AttachCacheHooks`
[🔗](https://github.com/Undeadlol1/ash_cache/blob/v0.1.0/lib/ash_cache/resource/transformers/attach_cache_hooks.ex#L1)

Wires caching into the resource's actions at compile time:

  * each cached read action gets the `AshCache.Preparations.ReadThrough`
    preparation, appended after any preparations the action declares
  * each cached generic action has its `run` replaced by
    `AshCache.Actions.RunThrough`, which calls the original on a miss
  * each cached calculation has its implementation replaced by
    `AshCache.Calculations.CalculateThrough`, which calls the original for
    the records not in the cache
  * every create/update/destroy gets the `AshCache.Changes.InvalidateCache`
    change, so invalidation is a property of the resource — an action added
    later cannot forget it

# `after_compile?`

# `before?`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
