Merge pull request #65 from ecentinela/master
Added a method to see the cache size
This commit is contained in:
commit
6660c51d36
|
@ -28,5 +28,6 @@
|
|||
- (void)clearMemory;
|
||||
- (void)clearDisk;
|
||||
- (void)cleanDisk;
|
||||
- (int)getSize;
|
||||
|
||||
@end
|
||||
|
|
|
@ -337,4 +337,17 @@ static SDImageCache *instance;
|
|||
}
|
||||
}
|
||||
|
||||
-(int)getSize
|
||||
{
|
||||
int size = 0;
|
||||
NSDirectoryEnumerator *fileEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:diskCachePath];
|
||||
for (NSString *fileName in fileEnumerator)
|
||||
{
|
||||
NSString *filePath = [diskCachePath stringByAppendingPathComponent:fileName];
|
||||
NSDictionary *attrs = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:nil];
|
||||
size += [attrs fileSize];
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue