Exposed cache paths - fixes #339

This commit is contained in:
Bogdan Poplauschi 2014-06-15 22:23:48 +03:00
parent a0bc09df7d
commit e6c0f56d1f
2 changed files with 21 additions and 2 deletions

View File

@ -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

View File

@ -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) {