| | |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | #import "SDWebImageCompat.h" |
| | | |
| | | @class SDImageCacheConfig; |
| | | #import "SDImageCacheConfig.h" |
| | | |
| | | typedef NS_ENUM(NSInteger, SDImageCacheType) { |
| | | /** |
| | |
| | | * The image was obtained from the memory cache. |
| | | */ |
| | | SDImageCacheTypeMemory |
| | | }; |
| | | |
| | | typedef NS_OPTIONS(NSUInteger, SDImageCacheOptions) { |
| | | /** |
| | | * By default, we do not query disk data when the image is cached in memory. This mask can force to query disk data at the same time. |
| | | */ |
| | | SDImageCacheQueryDataWhenInMemory = 1 << 0, |
| | | /** |
| | | * By default, we query the memory cache synchronously, disk cache asynchronously. This mask can force to query disk cache synchronously. |
| | | */ |
| | | SDImageCacheQueryDiskSync = 1 << 1, |
| | | /** |
| | | * By default, images are decoded respecting their original size. On iOS, this flag will scale down the |
| | | * images to a size compatible with the constrained memory of devices. |
| | | */ |
| | | SDImageCacheScaleDownLargeImages = 1 << 2 |
| | | }; |
| | | |
| | | typedef void(^SDCacheQueryCompletedBlock)(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType); |
| | |
| | | /** |
| | | * Synchronously store image NSData into disk cache at the given key. |
| | | * |
| | | * @warning This method is synchronous, make sure to call it from the ioQueue |
| | | * |
| | | * @param imageData The image data to store |
| | | * @param key The unique image cache key, usually it's image absolute URL |
| | |
| | | - (void)diskImageExistsWithKey:(nullable NSString *)key completion:(nullable SDWebImageCheckCacheCompletionBlock)completionBlock; |
| | | |
| | | /** |
| | | * Sync check if image data exists in disk cache already (does not load the image) |
| | | * |
| | | * @param key the key describing the url |
| | | */ |
| | | - (BOOL)diskImageDataExistsWithKey:(nullable NSString *)key; |
| | | |
| | | /** |
| | | * Operation that queries the cache asynchronously and call the completion when done. |
| | | * |
| | | * @param key The unique key used to store the wanted image |
| | |
| | | - (nullable NSOperation *)queryCacheOperationForKey:(nullable NSString *)key done:(nullable SDCacheQueryCompletedBlock)doneBlock; |
| | | |
| | | /** |
| | | * Operation that queries the cache asynchronously and call the completion when done. |
| | | * |
| | | * @param key The unique key used to store the wanted image |
| | | * @param options A mask to specify options to use for this cache query |
| | | * @param doneBlock The completion block. Will not get called if the operation is cancelled |
| | | * |
| | | * @return a NSOperation instance containing the cache op |
| | | */ |
| | | - (nullable NSOperation *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options done:(nullable SDCacheQueryCompletedBlock)doneBlock; |
| | | |
| | | /** |
| | | * Query the memory cache synchronously. |
| | | * |
| | | * @param key The unique key used to store the image |