Permalink
Browse files

Merge pull request #12 from jpm/master

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...
2 parents 018a217 + c3b7a97 commit a646caa37aa1809f3a54f616fb3a125174aa060b @shnhrrsn shnhrrsn committed Apr 19, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 EGOCache.m
View
5 EGOCache.m
@@ -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 a646caa

Please sign in to comment.