|
@@ -84,6 +84,11 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { |
|
@@ -84,6 +84,11 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { |
84
|
}
|
84
|
}
|
85
|
|
85
|
|
86
|
- (id)initWithNamespace:(NSString *)ns {
|
86
|
- (id)initWithNamespace:(NSString *)ns {
|
|
|
87
|
+ NSString *path = [self makeDiskCachePath:ns];
|
|
|
88
|
+ return [self initWithNamespace:ns diskCacheDirectory:path];
|
|
|
89
|
+}
|
|
|
90
|
+
|
|
|
91
|
+- (id)initWithNamespace:(NSString *)ns diskCacheDirectory:(NSString *)directory {
|
87
|
if ((self = [super init])) {
|
92
|
if ((self = [super init])) {
|
88
|
NSString *fullNamespace = [@"com.hackemist.SDWebImageCache." stringByAppendingString:ns];
|
93
|
NSString *fullNamespace = [@"com.hackemist.SDWebImageCache." stringByAppendingString:ns];
|
89
|
|
94
|
|
|
@@ -101,7 +106,12 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { |
|
@@ -101,7 +106,12 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { |
101
|
_memCache.name = fullNamespace;
|
106
|
_memCache.name = fullNamespace;
|
102
|
|
107
|
|
103
|
// Init the disk cache
|
108
|
// Init the disk cache
|
104
|
- _diskCachePath = [self makeDiskCachePath:fullNamespace];
|
109
|
+ if (directory != nil) {
|
|
|
110
|
+ _diskCachePath = [directory stringByAppendingPathComponent:fullNamespace];
|
|
|
111
|
+ } else {
|
|
|
112
|
+ NSString *path = [self makeDiskCachePath:ns];
|
|
|
113
|
+ _diskCachePath = path;
|
|
|
114
|
+ }
|
105
|
|
115
|
|
106
|
// Set decompression to YES
|
116
|
// Set decompression to YES
|
107
|
_shouldDecompressImages = YES;
|
117
|
_shouldDecompressImages = YES;
|