<jupyter_start><jupyter_text>Performance  Caching data<jupyter_code>If you want to avoid retrieving the same data several times during a working session, or if you fetched a large amount of data, you may want to temporarily save data in a cache file.

You can cache fetched data with the fetchers option ``cache``.

**Argopy** cached data are persistent, meaning that they are stored locally on files and will survive execution of your script with a new session. 
They have however an expiration time of one day, since this is the update frequency of most data sources. This will ensure you always have the last version of Argo data.

All data and meta-data (index) fetchers have a caching system.

The argopy default cache folder is under your home directory at ``~./.cache/argopy``. 
But you can specify the path you want to use in several ways:<jupyter_output><empty_output><jupyter_text>- with **argopy** global options: ```pythonargopy.set_options(cachedir='mycache_folder')``` - in a temporary context: ```pythonwith argopy.set_options(cachedir='mycache_folder'):    ds = ArgoDataFetcher(cache=True).profile(6902746, 34).to_xarray()``` - when instantiating the data fetcher: ```pythonds = ArgoDataFetcher(cache=True, cachedir='mycache_folder').profile(6902746, 34).to_xarray()```<jupyter_code>.. warning::

  You really need to set the ``cache`` option to ``True``. Specifying only the ``cachedir`` won't trigger caching !<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09327846364883402, 'fraction_numerical': 0.012345679012345678, 'mean_word_length': 5.631818181818182, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '451319', 'license': 'Apache-2.0', 'n_tokens_mistral': 430, 'n_tokens_neox': 410, 'n_words': 179, 'path': 'docs/performances.ipynb', 'repo_name': 'dhruvbalwada/argopy', 'size': '1458'}