For simple cases, we don’t need to. Let’s use urlCache
The URL cache for providing cached responses to requests within the session.
The URL Loading System caches responses both in memory and on disk, improving performance and reducing network traffic.
The URLCache class is used for caching responses from network resources. Your app can directly access the shared cache instance by using the shared property of URLCache. Or, you can create your own caches for different purposes, setting distinct caches on your URLSessionConfiguration objects.