Skip to content

Commit c3b7a97

Browse files
committed
Fixed small issue where expired entries wouldn't be removed from the dictionary file, resulting in very large files in the long run.
1 parent 018a217 commit c3b7a97

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

EGOCache.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,17 @@ - (id)init {
9696
attributes:nil
9797
error:NULL];
9898

99+
NSMutableArray *removeList = [NSMutableArray array];
99100
for(NSString* key in cacheDictionary) {
100101
NSDate* date = [cacheDictionary objectForKey:key];
101102
if([[[NSDate date] earlierDate:date] isEqualToDate:date]) {
103+
[removeList addObject:key];
102104
[[NSFileManager defaultManager] removeItemAtPath:cachePathForKey(key) error:NULL];
103105
}
104106
}
107+
if ([removeList count] > 0) {
108+
[cacheDictionary removeObjectsForKeys:removeList];
109+
}
105110
}
106111

107112
return self;

0 commit comments

Comments
 (0)