Created
August 28, 2012 08:54
-
-
Save mikeabdullah/3496338 to your computer and use it in GitHub Desktop.
Relying on dictionaries to retain their objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Foo *foo = [_cache objectForKey:key]; | |
if (!foo) | |
{ | |
foo = [[Foo alloc] init... | |
[_cache setObject:foo forKey:key]; | |
[foo release]; // expect the cache dictionary to retain it | |
} | |
return foo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment