Cache#
- class sunpy.data.data_manager.Cache(downloader, storage, cache_dir, expiry=<Quantity 10. d>)[source]#
Bases:
objectCache provides a way to download and cache files.
- Parameters:
downloader (Implementation of
DownloaderBase) – Downloader object for downloading remote files.storage (Implementation of
StorageProviderBase) – Storage to store metadata about the files.cache_dir (
strorpathlib.Path) – Directory where the downloaded files will be stored.expiry (
astropy.units.quantity.QuantityorNone, optional) – The interval after which the cache is invalidated. If the expiry isNone, then the expiry is not checked. Defaults to 10 days.
Methods Summary
download(urls[, namespace, redownload])Downloads the files from the urls.
get_by_hash(sha_hash)Returns the details which is matched by hash if present in cache.
Methods Documentation
- download(urls, namespace='', redownload=False)[source]#
Downloads the files from the urls.
- Parameters:
urls (
listof path-like or one path-like) – A list of urls or a single url. The list is for urls of the same file but from different sources.namespace (
str, optional) – A namespace to be used for the file name. Defaults to an empty string.redownload (
bool, optional) – Whether to skip cache and redownload. Defaults toFalse.
- Returns:
pathlib.Path– Path to the downloaded file.