# cached code? modified code is not used

**URL:** <https://forum.ansible.com/t/cached-code-modified-code-is-not-used/36264>\
**Category:** Ansible Project\
**Tags:** galaxy-ng\
**Created:** [January 31, 2022, 12:49pm UTC](https://forum.ansible.com/t/cached-code-modified-code-is-not-used/36264 "2022-01-31T12:49:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adriansev](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/adriansev/32/4866_2.png) [@adriansev](https://forum.ansible.com/u/adriansev)\
**Post date:** [January 31, 2022, 12:49pm UTC](https://forum.ansible.com/t/cached-code-modified-code-is-not-used/36264/1 "2022-01-31T12:49:20Z")

</div>

Hi! I have a weird situation and i’m not sure if this should be reported as a bug:  
I installed with galaxy a collection which i modified quite a lot. (a collection that add some facts). The really weird thing is that somehow the old version of the code is used  
and i still have the old output.  
Does anyone have any idea about this?  
Thank you!  
Adrian

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [February 2, 2022, 5:01pm UTC](https://forum.ansible.com/t/cached-code-modified-code-is-not-used/36264/2 "2022-02-02T17:01:45Z")

</div>

No code is cached between Ansible runs, but you CAN have 2 instances  
of the same collection installed, but only the first one loaded will  
be used, I suspect this is your issue.

---

<div class="post-metadata">

**Author:** ![adriansev](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/adriansev/32/4866_2.png) [@adriansev](https://forum.ansible.com/u/adriansev)\
**Post date:** [February 2, 2022, 6:02pm UTC](https://forum.ansible.com/t/cached-code-modified-code-is-not-used/36264/3 "2022-02-02T18:02:36Z")

</div>

I found the problem: this was about a facts plugin that i was working on,  
and i had redis-based persistent cache and high enough ttl.  
So, when running the facts gathering play, the code actually was not working,  
and ansible would just report back the cached facts giving me the wrong impression.

so, with --flush-cache i solved the problem and i can be certain that fresh facts are  
gathered each time.

Thank you!  
Adrian
