Skip to content

Commit

Permalink
Used cached definitions to improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio Padrino committed Mar 1, 2014
1 parent a8fd6aa commit 60e16ab
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Source/Factory/Block/TyphoonAssemblyDefinitionBuilder.m
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,22 @@ - (void)markKeyResolved:(NSString *)key
#pragma mark - Building
- (TyphoonDefinition *)populateCacheWithDefinitionForKey:(NSString *)key
{
id d = [self definitionForKey:key];
[self populateCacheWithDefinition:d forKey:key];
id d = [self cachedDefinitionForKey:key];

if (!d)
{
d = [self definitionForKey:key];
[self populateCacheWithDefinition:d forKey:key];
}

return d;
}

- (id)cachedDefinitionForKey:(NSString *)key
{
return _cachedDefinitionsForMethodName[key];
}

- (id)definitionForKey:(NSString *)key
{
// call the user's assembly method to get it.
Expand Down

0 comments on commit 60e16ab

Please sign in to comment.