Caching of remote pixel data is possible by setting a <Cache> element in the WMS (or WMTS) configuration file.
Before GDAL 3.9, if the <Path> sub-element of <Cache> was not specified, the
directory of the cache was ./gdalwmscache (that is to say a gdalwmscache
subdirectory of the current directory), unless the GDAL_DEFAULT_WMS_CACHE_PATH
configuration option is specified.
Starting with GDAL 3.9, the directory of the cache is set according to the following logic (first listed criterion is prioritary over following ones):
Value of the <Path> sub-element of <Cache>, if specified.
${GDAL_DEFAULT_WMS_CACHE_PATH}ifGDAL_DEFAULT_WMS_CACHE_PATHis set.${XDG_CACHE_HOME}/gdalwmscacheif theXDG_CACHE_HOMEconfiguration option is set.On Unix,
${HOME}/.cache/gdalwmscacheif theHOMEconfiguration option is set.On Windows,
${USERPROFILE}/.cache/gdalwmscacheif theUSERPROFILEconfiguration option is set.${CPL_TMPDIR}/gdalwmscache_${USER}ifCPL_TMPDIRandUSERconfiguration options are set.If
CPL_TMPDIRis not set, thenTMPDIRis used, orTEMPIf
USERis not set,USERNAMEis used if set. If neitherUSERNAMEorUSERare set, the md5sum of the filename of the configuration file is used)./gdalwmscache_{md5sum(filename)}if none of the above mentioned configuration options are set.
Note that if the <Unique> element is set to true (which is its default value), a subdirectory whose name is the md5sum of the filename of the configuration file is appended to the caching directory.
The actual caching directory can be got by querying the CACHE_PATH metadata
item on the dataset.