diff --git a/SDWebImage/SDImageCache.h b/SDWebImage/SDImageCache.h index 83fc4863..b713adea 100644 --- a/SDWebImage/SDImageCache.h +++ b/SDWebImage/SDImageCache.h @@ -202,4 +202,23 @@ typedef void(^SDWebImageQueryCompletedBlock)(UIImage *image, SDImageCacheType ca */ - (BOOL)diskImageExistsWithKey:(NSString *)key; +/** + * Get the cache path for a certain key (needs the cache path root folder) + * + * @param key the key (can be obtained from url using cacheKeyForURL) + * @param path the cach path root folder + * + * @return the cache path + */ +- (NSString *)cachePathForKey:(NSString *)key inPath:(NSString *)path; + +/** + * Get the default cache path for a certain key + * + * @param key the key (can be obtained from url using cacheKeyForURL) + * + * @return the default cache path + */ +- (NSString *)defaultCachePathForKey:(NSString *)key; + @end diff --git a/SDWebImage/SDImageCache.m b/SDWebImage/SDImageCache.m index 9ce82e21..0df9ad5f 100644 --- a/SDWebImage/SDImageCache.m +++ b/SDWebImage/SDImageCache.m @@ -116,8 +116,6 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { } } -#pragma mark SDImageCache (private) - - (NSString *)cachePathForKey:(NSString *)key inPath:(NSString *)path { NSString *filename = [self cachedFileNameForKey:key]; return [path stringByAppendingPathComponent:filename]; @@ -127,6 +125,8 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { return [self cachePathForKey:key inPath:self.diskCachePath]; } +#pragma mark SDImageCache (private) + - (NSString *)cachedFileNameForKey:(NSString *)key { const char *str = [key UTF8String]; if (str == NULL) {