Nuke 7.3
This release introduces new DataCache
type and features some other improvements in custom data caching.
- Add new
DataCache
type - a cache backed by a local storage with an LRU cleanup policy. This type is a reworked version of the experimental data cache which was added in Nuke 7.0. It's now much simpler and also faster. It allows for reading and writing in parallel, it has a simple consistent API, and I hope it's going to be a pleasure to use.
Migration note: The storage format - which is simply a bunch of files in a directory really - is backward compatible with the previous implementation. If you'd like the new cache to continue working with the same path, please create it with "com.github.kean.Nuke.DataCache" name and use the same filename generator that you were using before:
try? DataCache(name: "com.github.kean.Nuke.DataCache", filenameGenerator: filenameGenerator)
-
#160
DataCache
now has a defaultFilenameGenerator
on Swift 4.2 which usesSHA1
hash function provided byCommonCrypto
(CommonCrypto
is not available on the previous versions of Swift). -
#171 Fix a regression introduced in version 7.1 where experimental
DataCache
would not perform LRU data sweeps. -
Update
DataCaching
protocol. To store data you now need to implement a synchronous methodfunc cachedData(for key: String) -> Data?
. This change was necessary to make the data cache fit nicely inImagePipeline
infrastructure where each stage is managed by a separateOperationQueue
and each operation respects the priority of the image requests associated with it. -
Add
dataCachingQueue
parameter toImagePipeline.Configuration
. The defaultmaxConcurrentOperationCount
is2
. -
Improve internal
Operation
type performance.