Permalink
Browse files

fix accidental release instead of removeallobjects in memory cache, a…

…dd unit test for removing all objects
  • Loading branch information...
1 parent 2856bfa commit 5f374ee941ad040187430c0d97a84a0d935a3d22 @clawoo committed Mar 23, 2011
View
@@ -47,7 +47,8 @@ - (BOOL)objectAvailableForKeyPath:(NSString *)keyPath {
- (NSData *)objectForKeyPath:(NSString *)keyPath {
NSAssert([keyPath length], @"keyPath cannot be nil or empty");
- NSNumber *timestamp = [expirationDates_ objectForKey:[keyPath md5]];
+ NSNumber *timestamp =
+ [expirationDates_ objectForKey:[keyPath md5]];
NSNumber *currentTimestamp = [NSNumber numberWithDouble:[NSDate timeIntervalSinceReferenceDate]];
if ([timestamp compare:currentTimestamp] == NSOrderedAscending) {
[memoryCache_ removeObjectForKey:[keyPath md5]];
@@ -62,13 +63,13 @@ - (void)removeObjectForKeyPath:(NSString *)keyPath {
}
- (void)removeAllObjects {
- [expirationDates_ release];
+ [expirationDates_ removeAllObjects];
[memoryCache_ removeAllObjects];
}
- (void)dealloc {
- [memoryCache_ release];
[expirationDates_ release];
+ [memoryCache_ release];
[super dealloc];
}
Oops, something went wrong.

0 comments on commit 5f374ee

Please sign in to comment.