You can access the + (AFImageCache *)af_sharedImageCache
by simply copying it to the UIImageView+AFNetworking.h
interface file. This will open a subclass of single-user NSCache. You can then call – removeObjectForKey:
or – removeAllObjects
to remove the image or all images, respectively.
If you do not want to do this, consider that the image is cached using the NSHTTPURLResponse
object as the key. You can create another key by adding some random value to the URL (for example, you can add ?garbage=4H5G789H35G89H
). However, this will mostly lose memory, as you will cache images that will never be recovered.
Finally, you may want to send an improvement request (or the code itself is one) to open the cache or make caching optional.
source share