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