Add caching for getLocalFile on remote storages

Fixes #6509

This adds caching for the common implementation of `getLocalFile` and caching for `fopen` in the webdav storage.
Additional caching can be add for other storage backends later.

cc @DeepDiver1975 @PVince81