# Passing a Cache to optimization function

**URL:** <https://discourse.julialang.org/t/passing-a-cache-to-optimization-function/129321>\
**Category:** Optimization (Mathematical)\
**Tags:** optimization, autodiff, enzyme\
**Created:** [May 25, 2025, 5:35pm UTC](https://discourse.julialang.org/t/passing-a-cache-to-optimization-function/129321 "2025-05-25T17:35:25Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![wsmoses](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wsmoses/32/26497_2.png) [@wsmoses](https://discourse.julialang.org/u/wsmoses)\
**Post date:** [May 29, 2025, 6:15pm UTC](https://discourse.julialang.org/t/passing-a-cache-to-optimization-function/129321/21 "2025-05-29T18:15:11Z")

</div>

Well glad that fixed it.

Does it now work end to end?

---

<div class="post-metadata">

**Author:** ![miguelborrero](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Post date:** [May 29, 2025, 6:24pm UTC](https://discourse.julialang.org/t/passing-a-cache-to-optimization-function/129321/22 "2025-05-29T18:24:57Z")

</div>

Yes! Just tried it and it worked end to end! Thanks so much.

@wsmoses Just to complete the circle completely, may I ask for a few sentences of explanation as to why the solution you proposed worked?

[Previous page](https://discourse.julialang.org/t/passing-a-cache-to-optimization-function/129321.md?page=1)
