# How to use cached facts inside ansible module and caching custom facts

**URL:** <https://forum.ansible.com/t/how-to-use-cached-facts-inside-ansible-module-and-caching-custom-facts/18709>\
**Category:** Ansible Project\
**Created:** [July 7, 2015, 11:30pm UTC](https://forum.ansible.com/t/how-to-use-cached-facts-inside-ansible-module-and-caching-custom-facts/18709 "2015-07-07T23:30:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yasir\_Saleem](https://avatars.discourse-cdn.com/v4/letter/y/13edae/32.png) [@Yasir\_Saleem](https://forum.ansible.com/u/Yasir_Saleem)\
**Post date:** [July 7, 2015, 11:30pm UTC](https://forum.ansible.com/t/how-to-use-cached-facts-inside-ansible-module-and-caching-custom-facts/18709/1 "2015-07-07T23:30:18Z")

</div>

Hi,  
I am writing module that validates host facts(large number of them) with inventory database for audit and monitoring purposes. I have couple of questions in this regard:

1. Is there a way to cache custom facts?
2. Is there an API to use cached or ansible gathered facts inside module?

Thanks,  
Yasir.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 7, 2015, 11:39pm UTC](https://forum.ansible.com/t/how-to-use-cached-facts-inside-ansible-module-and-caching-custom-facts/18709/2 "2015-07-07T23:39:58Z")

</div>

1. they are cached with rest of facts  
2. no
