Authored by Bogdan Poplauschi

Pragma marks for code readability

@@ -146,7 +146,7 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot @@ -146,7 +146,7 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
146 */ 146 */
147 - (void)storeImageDataToDisk:(nullable NSData *)imageData forKey:(nullable NSString *)key; 147 - (void)storeImageDataToDisk:(nullable NSData *)imageData forKey:(nullable NSString *)key;
148 148
149 -#pragma mark - Query Ops 149 +#pragma mark - Query and Retrieve Ops
150 150
151 /** 151 /**
152 * Operation that queries the cache asynchronously and call the completion when done. 152 * Operation that queries the cache asynchronously and call the completion when done.
@@ -179,6 +179,8 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot @@ -179,6 +179,8 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
179 */ 179 */
180 - (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key; 180 - (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key;
181 181
  182 +#pragma mark - Remove Ops
  183 +
182 /** 184 /**
183 * Remove the image from memory and disk cache asynchronously 185 * Remove the image from memory and disk cache asynchronously
184 * 186 *
@@ -186,7 +188,6 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot @@ -186,7 +188,6 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
186 */ 188 */
187 - (void)removeImageForKey:(nullable NSString *)key; 189 - (void)removeImageForKey:(nullable NSString *)key;
188 190
189 -  
190 /** 191 /**
191 * Remove the image from memory and disk cache asynchronously 192 * Remove the image from memory and disk cache asynchronously
192 * 193 *
@@ -212,6 +213,8 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot @@ -212,6 +213,8 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
212 */ 213 */
213 - (void)removeImageForKey:(nullable NSString *)key fromDisk:(BOOL)fromDisk withCompletion:(nullable SDWebImageNoParamsBlock)completion; 214 - (void)removeImageForKey:(nullable NSString *)key fromDisk:(BOOL)fromDisk withCompletion:(nullable SDWebImageNoParamsBlock)completion;
214 215
  216 +#pragma mark - Cache clean Ops
  217 +
215 /** 218 /**
216 * Clear all memory cached images 219 * Clear all memory cached images
217 */ 220 */
@@ -229,6 +232,8 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot @@ -229,6 +232,8 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
229 */ 232 */
230 - (void)deleteOldFilesWithCompletionBlock:(nullable SDWebImageNoParamsBlock)completionBlock; 233 - (void)deleteOldFilesWithCompletionBlock:(nullable SDWebImageNoParamsBlock)completionBlock;
231 234
  235 +#pragma mark - Cache Info
  236 +
232 /** 237 /**
233 * Get the size used by the disk cache 238 * Get the size used by the disk cache
234 */ 239 */
@@ -253,6 +258,8 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot @@ -253,6 +258,8 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
253 */ 258 */
254 - (void)diskImageExistsWithKey:(nullable NSString *)key completion:(nullable SDWebImageCheckCacheCompletionBlock)completionBlock; 259 - (void)diskImageExistsWithKey:(nullable NSString *)key completion:(nullable SDWebImageCheckCacheCompletionBlock)completionBlock;
255 260
  261 +#pragma mark - Cache Paths
  262 +
256 /** 263 /**
257 * Get the cache path for a certain key (needs the cache path root folder) 264 * Get the cache path for a certain key (needs the cache path root folder)
258 * 265 *
@@ -275,7 +275,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { @@ -275,7 +275,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
275 }); 275 });
276 } 276 }
277 277
278 -#pragma mark - Query Ops 278 +#pragma mark - Query and Retrieve Ops
279 279
280 - (nullable UIImage *)imageFromMemoryCacheForKey:(nullable NSString *)key { 280 - (nullable UIImage *)imageFromMemoryCacheForKey:(nullable NSString *)key {
281 return [self.memCache objectForKey:key]; 281 return [self.memCache objectForKey:key];
@@ -402,6 +402,8 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { @@ -402,6 +402,8 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
402 return operation; 402 return operation;
403 } 403 }
404 404
  405 +#pragma mark - Remove Ops
  406 +
405 - (void)removeImageForKey:(nullable NSString *)key { 407 - (void)removeImageForKey:(nullable NSString *)key {
406 [self removeImageForKey:key withCompletion:nil]; 408 [self removeImageForKey:key withCompletion:nil];
407 } 409 }
@@ -440,6 +442,8 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { @@ -440,6 +442,8 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
440 442
441 } 443 }
442 444
  445 +# pragma mark - Mem Cache settings
  446 +
443 - (void)setMaxMemoryCost:(NSUInteger)maxMemoryCost { 447 - (void)setMaxMemoryCost:(NSUInteger)maxMemoryCost {
444 self.memCache.totalCostLimit = maxMemoryCost; 448 self.memCache.totalCostLimit = maxMemoryCost;
445 } 449 }
@@ -456,6 +460,8 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { @@ -456,6 +460,8 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
456 self.memCache.countLimit = maxCountLimit; 460 self.memCache.countLimit = maxCountLimit;
457 } 461 }
458 462
  463 +#pragma mark - Cache clean Ops
  464 +
459 - (void)clearMemory { 465 - (void)clearMemory {
460 [self.memCache removeAllObjects]; 466 [self.memCache removeAllObjects];
461 } 467 }
@@ -580,6 +586,8 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { @@ -580,6 +586,8 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
580 } 586 }
581 #endif 587 #endif
582 588
  589 +#pragma mark - Cache Info
  590 +
583 - (NSUInteger)getSize { 591 - (NSUInteger)getSize {
584 __block NSUInteger size = 0; 592 __block NSUInteger size = 0;
585 dispatch_sync(self.ioQueue, ^{ 593 dispatch_sync(self.ioQueue, ^{