MugunthKumar / MKNetworkKit

Modern NSURLSession based Networking Framework with built in authentication and HTTP 1.1 caching standards support for iOS 8+ devices
http://mk.sg/8w
3.06k stars 755 forks source link

Caching manipulated (resized) UIImage #110

Closed holtwick closed 12 years ago

holtwick commented 12 years ago

Hi, I love this project. Awesome work!

Image loading works great. But in my app I do some image manipulation before dsplaying the thumbnail, like resizing, croping, removing alpha and adding a border. It would be great to cache this, because it would have some advantages:

  1. Smaller memory and disk footprint
  2. Faster and more responsive image display for cached entries

I was not able to find a good place where to add this step in your code, therefore I add this feature request to get your help. Or should I better do the caching in my code?

This is how the competion solves the problem ;) https://github.com/AFNetworking/AFNetworking/blob/master/AFNetworking/AFImageRequestOperation.m#L107

MugunthKumar commented 12 years ago

You should do the caching in your code. IMO, networking frameworks should cache based on HTTP Headers and not based on application logic. One application's logic might not work with another. For example, in your case, how do you control cache expiry of a a resized/cropped image?

holtwick commented 12 years ago

Ok, you're probably right. I thought it would have made sense to use the caching infrastructure of MKNetworkKit. By just replacing the response data with the data of a processed image it might have used the same cache expiry behaviour.