Pragma marks for code readability

This commit is contained in:
Bogdan Poplauschi 2016-09-23 23:43:06 +03:00
parent f202b50330
commit 3e78e29480
2 changed files with 18 additions and 3 deletions

View File

@ -146,7 +146,7 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
*/ */
- (void)storeImageDataToDisk:(nullable NSData *)imageData forKey:(nullable NSString *)key; - (void)storeImageDataToDisk:(nullable NSData *)imageData forKey:(nullable NSString *)key;
#pragma mark - Query Ops #pragma mark - Query and Retrieve Ops
/** /**
* Operation that queries the cache asynchronously and call the completion when done. * Operation that queries the cache asynchronously and call the completion when done.
@ -179,6 +179,8 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
*/ */
- (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key; - (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key;
#pragma mark - Remove Ops
/** /**
* Remove the image from memory and disk cache asynchronously * Remove the image from memory and disk cache asynchronously
* *
@ -186,7 +188,6 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
*/ */
- (void)removeImageForKey:(nullable NSString *)key; - (void)removeImageForKey:(nullable NSString *)key;
/** /**
* Remove the image from memory and disk cache asynchronously * Remove the image from memory and disk cache asynchronously
* *
@ -212,6 +213,8 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
*/ */
- (void)removeImageForKey:(nullable NSString *)key fromDisk:(BOOL)fromDisk withCompletion:(nullable SDWebImageNoParamsBlock)completion; - (void)removeImageForKey:(nullable NSString *)key fromDisk:(BOOL)fromDisk withCompletion:(nullable SDWebImageNoParamsBlock)completion;
#pragma mark - Cache clean Ops
/** /**
* Clear all memory cached images * Clear all memory cached images
*/ */
@ -229,6 +232,8 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
*/ */
- (void)deleteOldFilesWithCompletionBlock:(nullable SDWebImageNoParamsBlock)completionBlock; - (void)deleteOldFilesWithCompletionBlock:(nullable SDWebImageNoParamsBlock)completionBlock;
#pragma mark - Cache Info
/** /**
* Get the size used by the disk cache * Get the size used by the disk cache
*/ */
@ -253,6 +258,8 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
*/ */
- (void)diskImageExistsWithKey:(nullable NSString *)key completion:(nullable SDWebImageCheckCacheCompletionBlock)completionBlock; - (void)diskImageExistsWithKey:(nullable NSString *)key completion:(nullable SDWebImageCheckCacheCompletionBlock)completionBlock;
#pragma mark - Cache Paths
/** /**
* Get the cache path for a certain key (needs the cache path root folder) * Get the cache path for a certain key (needs the cache path root folder)
* *

View File

@ -275,7 +275,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
}); });
} }
#pragma mark - Query Ops #pragma mark - Query and Retrieve Ops
- (nullable UIImage *)imageFromMemoryCacheForKey:(nullable NSString *)key { - (nullable UIImage *)imageFromMemoryCacheForKey:(nullable NSString *)key {
return [self.memCache objectForKey:key]; return [self.memCache objectForKey:key];
@ -402,6 +402,8 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
return operation; return operation;
} }
#pragma mark - Remove Ops
- (void)removeImageForKey:(nullable NSString *)key { - (void)removeImageForKey:(nullable NSString *)key {
[self removeImageForKey:key withCompletion:nil]; [self removeImageForKey:key withCompletion:nil];
} }
@ -440,6 +442,8 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
} }
# pragma mark - Mem Cache settings
- (void)setMaxMemoryCost:(NSUInteger)maxMemoryCost { - (void)setMaxMemoryCost:(NSUInteger)maxMemoryCost {
self.memCache.totalCostLimit = maxMemoryCost; self.memCache.totalCostLimit = maxMemoryCost;
} }
@ -456,6 +460,8 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
self.memCache.countLimit = maxCountLimit; self.memCache.countLimit = maxCountLimit;
} }
#pragma mark - Cache clean Ops
- (void)clearMemory { - (void)clearMemory {
[self.memCache removeAllObjects]; [self.memCache removeAllObjects];
} }
@ -580,6 +586,8 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
} }
#endif #endif
#pragma mark - Cache Info
- (NSUInteger)getSize { - (NSUInteger)getSize {
__block NSUInteger size = 0; __block NSUInteger size = 0;
dispatch_sync(self.ioQueue, ^{ dispatch_sync(self.ioQueue, ^{