Files
RestKit/Code/CoreData/RKManagedObjectMappingCache.h
Blake Watters a545c3942b Integrated primaryKey extension to NSEntityDescription and refactored cache strategy
classes to eliminate issues with duplicated objects. closes #611, #612, #613, #618

* NSEntityDescription is now aware of the primaryKeyAttribute. Can be configured via
Interface Builder within Xcode or programatically.
* Added findByPrimaryKey: interface to the Core Data extensions.
* Relaxed dependencies on RKManagedObjectMapping across the system now that primaryKey is
available without a reference to the mapping.
2012-04-03 23:39:42 -04:00

36 lines
1.5 KiB
Objective-C

//
// RKManagedObjectCacheing.h
// RestKit
//
// Created by Jeff Arena on 1/24/12.
// Copyright (c) 2012 RestKit. All rights reserved.
//
#import <CoreData/CoreData.h>
/**
Objects implementing the RKManagedObjectCacheing protocol can act as the cache
strategy for RestKit managed object stores. The managed object cache is consulted
when objects are retrieved from Core Data during object mapping operations and provide
an opportunity to accelerate the mapping process by trading memory for speed.
*/
@protocol RKManagedObjectCacheing
/**
Retrieves a model object from the object store given a Core Data entity and
the primary key attribute and value for the desired object.
@param entity The Core Data entity for the type of object to be retrieved from the cache.
@param primaryKeyAttribute The name of the attribute that acts as the primary key for the entity.
@param primaryKeyValue The value for the primary key attribute of the object to be retrieved from the cache.
@param mmanagedObjectContext The managed object context to be searched for a matching instance.
@return A managed object that is an instance of the given entity with a primary key and value matching
the specified parameters, or nil if no object was found.
*/
- (NSManagedObject *)findInstanceOfEntity:(NSEntityDescription *)entity
withPrimaryKeyAttribute:(NSString *)primaryKeyAttribute
value:(id)primaryKeyValue
inManagedObjectContext:(NSManagedObjectContext *)managedObjectContext;
@end