Cache plugins allow Ansible to store gathered facts or inventory source data. It is implemented in the backend. The default cache plugin is the memory plugin which only caches data related to the current Ansible execution.
You can also use a separate cache plugin for inventory and facts.
You can enable a cache plugin in the Ansible configuration
export ANSIBLE_CACHE_PLUGIN=jsonfile