SDWebImage 的缓存在哪里?

Where is the cache for SDWebImage?

我检查了 NSBundle,但找不到 SDWebImage 保存图像的缓存。缓存是否启用(见下面的代码)?根据 Docs 它进行缓存管理。

如文档中所述:

Just #import the UIImageView+WebCache.h header, and call the sd_setImageWithURL:placeholderImage: method from the tableView:cellForRowAtIndexPath: UITableViewDataSource method. Everything will be handled for you, from async downloads to caching management.

#import <SDWebImage/UIImageView+WebCache.h>

...

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        static NSString *MyIdentifier = @"MyIdentifier";

        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
        if (cell == nil) {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                           reuseIdentifier:MyIdentifier] autorelease];
        }

        // Here we use the new provided sd_setImageWithURL: method to load the web image
        [cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
                          placeholderImage:[UIImage imageNamed:@"placeholder.png"]];

        cell.textLabel.text = @"My Text";
        return cell;
    }

在沙盒的库文件夹中

您的申请ID/Library/Caches/com.hackemist.SDWebImageCache.default/

在您的项目中搜索以下代码行。 _diskCachePathSDWebImagecache

if (![_fileManager fileExistsAtPath:_diskCachePath]) {
                [_fileManager createDirectoryAtPath:_diskCachePath withIntermediateDirectories:YES attributes:nil error:NULL];
            }