Skip to content

Instantly share code, notes, and snippets.

@mikeabdullah
Created August 28, 2012 08:54
Show Gist options
  • Save mikeabdullah/3496338 to your computer and use it in GitHub Desktop.
Save mikeabdullah/3496338 to your computer and use it in GitHub Desktop.
Relying on dictionaries to retain their objects
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