遵照:AFImageCache
聲明:AFAutoPurgingImageCache.h
概述
ImageRequestCache協(xié)議是ImageCache協(xié)議的擴(kuò)展,增加了從緩存中根據(jù)NSURLRequest和額外的標(biāo)識(shí)來(lái)新增,移除和獲取圖片的方法。
任務(wù)
必須實(shí)現(xiàn)的方法
– addImage:forRequest:withAdditionalIdentifier:
– removeImageforRequest:withAdditionalIdentifier:
– imageforRequest:withAdditionalIdentifier:
實(shí)例方法
– addImage:forRequest:withAdditionalIdentifier:
- (void)addImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier
討論
將請(qǐng)求和額外標(biāo)識(shí)創(chuàng)建的圖片使用一個(gè)標(biāo)識(shí)添加到緩存。
參數(shù)
image
添加到緩存的圖片。
request
唯一的URL請(qǐng)求識(shí)別圖片資源。
identifier
額外的標(biāo)識(shí)提供URL請(qǐng)求識(shí)別圖片。
聲明處
AFAutoPurgingImageCache.h
imageforRequest:withAdditionalIdentifier:
- (nullable UIImage *)imageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier
討論
根據(jù)請(qǐng)求和額外標(biāo)識(shí)的創(chuàng)建的一個(gè)標(biāo)識(shí)符,返回一張緩存中的圖片。
參數(shù)
request
唯一的URL請(qǐng)求識(shí)別圖片資源。
Identifier
額外的標(biāo)識(shí)提供URL請(qǐng)求識(shí)別圖片。
返回值
請(qǐng)求和標(biāo)識(shí)符匹配的圖片,有可能為nil。
聲明處
AFAutoPurgingImageCache.h
removeImageforRequest:withAdditionalIdentifier:
- (BOOL)removeImageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier
討論
根據(jù)請(qǐng)求和額外標(biāo)識(shí)創(chuàng)建的一個(gè)標(biāo)識(shí)符,從緩存中移除圖片。
參數(shù)
request
唯一的URL請(qǐng)求識(shí)別圖片資源。
identifier
額外的標(biāo)識(shí)提供URL請(qǐng)求識(shí)別圖片。
返回值
緩存中所有的圖片被移除時(shí)返回YES,否則返回NO。
聲明處
AFAutoPurgingImageCache.h
// END
復(fù)合語(yǔ)句 真心不知道怎么翻譯,但是我可以看懂。