Skip to content

Commit

Permalink
Add DataLoader.sharedUrlCache
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jun 11, 2017
1 parent 2e5644b commit 4b6afc2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Sources/DataLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,17 @@ public final class DataLoader: DataLoading {

private static var defaultConf: URLSessionConfiguration {
let conf = URLSessionConfiguration.default
conf.urlCache = URLCache(
memoryCapacity: 0,
diskCapacity: 150 * 1024 * 1024, // 150 MB
diskPath: "com.github.kean.Nuke.Cache"
)
conf.urlCache = DataLoader.sharedUrlCache
return conf
}

/// Shared url cached used by a default `DataLoader`.
public static let sharedUrlCache = URLCache(
memoryCapacity: 0,
diskCapacity: 150 * 1024 * 1024, // 150 MB
diskPath: "com.github.kean.Nuke.Cache"
)

private static var defaultScheduler: AsyncScheduler {
return RateLimiter(scheduler: OperationQueueScheduler(maxConcurrentOperationCount: 6))
}
Expand Down

0 comments on commit 4b6afc2

Please sign in to comment.