The SDWebImage project provides a similar UIImageView category, but offers both in-memory caching (using NSCache) and on-disk caching (using NSFileManager). I would recommend just using this when you need to cache to disk.
The disadvantage of this implementation is that your network requests will not go through your AFHTTPClient subclass, so depending on your needs, you may need to implement your own operation queue, authentication, etc. If you're just using it for something basic, like displaying avatar images in a table, for example, this should be fine.
If this drawback bothers you, an alternative idea would be to use SDImageCache (included in the SDWebImage project) to cache images and download them yourself using AFNetworking.
Finally, note that AFNetworking has built-in support for NSURLCache , and if you create it, it will cache your images to disk. However, image caching is typically used to display a large number of images in a UIScrollView , and NSURLCache does not have enough performance for smooth scrolling.
source share