CNLiveWebImageManager.h 1.33 KB
//
//  CNLiveWebImageManager.h
//  WSWebImageDemo
//
//  Created by 王帅 on 16/7/27.
//  Copyright © 2016年 王帅. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "CNLiveWebImageBlock.h"
#import "CNLiveWebImageOperation.h"

typedef NS_OPTIONS(NSUInteger, CNLiveWebImageOptions) {
    CNLiveWebImageRetryFailed = 1 << 0,
    CNLiveWebImageCacheMemoryOnly = 1 << 1,
    CNLiveWebImageProgressiveDownload = 1 << 2,
    CNLiveWebImageContinueInBackground = 1 << 3
};

@interface CNLiveWebImageManager : NSObject

+ (nonnull id)sharedManager;

- (nonnull id <CNLiveWebImageOperation>)downloadWebImageWithURL:(nonnull NSURL *)url options:(CNLiveWebImageOptions)options progress:(nonnull CNLiveDownloadProgressBlock)progress completed:(nonnull CNLiveDownloadCompletedBlock)completed;

- (void)storeImage:(nonnull UIImage *)image imageUrl:(nonnull NSURL *)url toDisk:(BOOL)toDisk;

- (nullable UIImage *)imageFromMemoryCacheWithImageUrl:(nonnull NSURL *)url;

- (nullable UIImage *)imageFromDiskCacheWithImageUrl:(nonnull NSURL *)url;

- (BOOL)queryDiskCacheWithImageUrl:(nonnull NSURL *)url done:(nonnull CNLiveWebImageQueryCompletedBlock)doneBlock;

- (void)removeCacheWithUrl:(nonnull NSURL *)url done:(nonnull CNLiveCompletedBlock)completed;

- (long long)diskCacheSize;

- (void)clearMemory;

- (void)clearDisk;

@end