skjiisa / WebDAV-Swift

WebDAV communication library for Swift with caching and thumbnail support
BSD 2-Clause "Simplified" License
65 stars 17 forks source link

Replace Networkings dictionary with cache that can be passed to temporary Networkings #18

Closed skjiisa closed 3 years ago

skjiisa commented 3 years ago

Right now, there is a dictionary of Networkings for each base URL that gets accessed. Each one has its own memory cache. These could instead be replaced by a single memory cache in WebDAV where a Networking instance is created for each request. This would consolidate the caches and simplify request creation.

The issue with this is that Networking cancels requests based on the Networking object the request was created on. The return of the image fetch function (which is currently a String with the request ID) would either need to be the Networking itself (from which cancelAllRequests() could be called to cancel its one request), or the URLSessionTask of the request. The latter would be ideal to match the existing WebDAV functions, but would require a modification to Networking itself, as the session property is internal and there is no function returning the task.

skjiisa commented 3 years ago

This would be made obsolete with #21.