Closed
Description
Thanks for the excellent cache library.
When using for caching images I noticed that you take the UIImage data as PNG or JPEG then serialize it into a JSON like
{"object":{"image":"\/9j\/4AAQSkZJRgABAQAASABIAAD\/4QBYRXhpZ...
This transformation I'm afraid is expensive, the resulting cache files also are easily double in size from the original binary. Then when we retrieve the data from the cache we have to deserialize it again.
So what happens now:
- Fetch data from URL
- Load it into UIImage
- Send it to Cache:
3.1 Convert back to Data as PNG or JSON, depending on Alpha channel, again
3.2 Wrap it into a Codable
3.3 Serialize into JSON text (larger size)
3.4 Save to cache (disk and memory)
then in reverse when retrieving..
I prefer the way your previous Swift 3 version of the library worked where it would cache the actual data we fetch from a URL.
Metadata
Metadata
Assignees
Labels
No labels