diff --git a/FastEasyMapping/Source/Cache/FEMObjectCache.m b/FastEasyMapping/Source/Cache/FEMObjectCache.m index 7b7eb92..96743c4 100644 --- a/FastEasyMapping/Source/Cache/FEMObjectCache.m +++ b/FastEasyMapping/Source/Cache/FEMObjectCache.m @@ -12,7 +12,7 @@ }; @implementation FEMObjectCache { - NSMapTable *> *_lookupObjectsMap; + NSMutableDictionary *> *_lookupObjectsMap; FEMObjectCacheSource _source; } @@ -22,9 +22,7 @@ - (instancetype)initWithSource:(FEMObjectCacheSource)source { self = [super init]; if (self) { _source = source ?: FEMObjectCacheSourceStub; - - NSPointerFunctionsOptions options = NSPointerFunctionsObjectPointerPersonality | NSPointerFunctionsStrongMemory; - _lookupObjectsMap = [[NSMapTable alloc] initWithKeyOptions:options valueOptions:options capacity:0]; + _lookupObjectsMap = [[NSMutableDictionary alloc] init]; } return self; @@ -47,10 +45,10 @@ - (NSMutableDictionary *)fetchExistingObjectsForMapping:(FEMMapping *)mapping { } - (NSMutableDictionary *)cachedObjectsForMapping:(FEMMapping *)mapping { - NSMutableDictionary *entityObjectsMap = [_lookupObjectsMap objectForKey:mapping]; + NSMutableDictionary *entityObjectsMap = _lookupObjectsMap[mapping.uniqueIdentifier]; if (!entityObjectsMap) { entityObjectsMap = [self fetchExistingObjectsForMapping:mapping]; - [_lookupObjectsMap setObject:entityObjectsMap forKey:mapping]; + _lookupObjectsMap[mapping.uniqueIdentifier] = entityObjectsMap; } return entityObjectsMap;