Permalink
Browse files

Fixed small issue where expired entries wouldn't be removed from the …

…dictionary file, resulting in very large files in the long run.
  • Loading branch information...
1 parent 018a217 commit c3b7a97d75d22572100b3f2fd208bd97cc952bc1 @jpm jpm committed Apr 19, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 EGOCache.m
View
@@ -96,12 +96,17 @@ - (id)init {
attributes:nil
error:NULL];
+ NSMutableArray *removeList = [NSMutableArray array];
for(NSString* key in cacheDictionary) {
NSDate* date = [cacheDictionary objectForKey:key];
if([[[NSDate date] earlierDate:date] isEqualToDate:date]) {
+ [removeList addObject:key];
[[NSFileManager defaultManager] removeItemAtPath:cachePathForKey(key) error:NULL];
}
}
+ if ([removeList count] > 0) {
+ [cacheDictionary removeObjectsForKeys:removeList];
+ }
}
return self;

0 comments on commit c3b7a97

Please sign in to comment.