RKInMemoryEntityCache Class Reference
Inherits from | NSObject |
Declared in | RKInMemoryEntityCache.h RKInMemoryEntityCache.m |
Overview
Instances of RKInMemoryEntityCache provide an in-memory caching mechanism for objects in a Core Data managed object context. Managed objects can be cached by attribute for fast retrieval without repeatedly hitting the Core Data persistent store. This can provide a substantial speed advantage over issuing fetch requests in cases where repeated look-ups of the same data are performed using a small set of attributes as the query key. Internally, the cache entries are maintained as references to the NSManagedObjectID of corresponding cached objects.
Tasks
Other Methods
-
managedObjectContext
The managed object context from which objects will be cached.
property
Initializing the Cache
-
– initWithManagedObjectContext:
Initializes the receiver with a managed object context containing the entity instances to be cached.
Cacheing Objects by Attribute
-
– cachedObjectsForEntity:byAttribute:inContext:
Retrieves all objects within the cache
-
– cachedObjectForEntity:withAttribute:value:inContext:
-
– cacheObjectsForEntity:byAttribute:inContext:
Caches all instances of an entity in a given managed object context by the value
-
– cacheObject:byAttribute:inContext:
-
– cacheObject:byAttribute:value:inContext:
-
– expireCacheEntryForObject:byAttribute:inContext:
-
– expireCacheEntriesForEntity:
Instance Methods
cacheObject:byAttribute:inContext:
- (void)cacheObject:(NSManagedObject *)managedObject byAttribute:(NSString *)attributeName inContext:(NSManagedObjectContext *)managedObjectContext
Declared In
RKInMemoryEntityCache.h
cacheObject:byAttribute:value:inContext:
- (void)cacheObject:(NSEntityDescription *)entity byAttribute:(NSString *)attributeName value:(id)primaryKeyValue inContext:(NSManagedObjectContext *)managedObjectContext
Declared In
RKInMemoryEntityCache.h
cacheObjectsForEntity:byAttribute:inContext:
Caches all instances of an entity in a given managed object context by the value
- (void)cacheObjectsForEntity:(NSEntityDescription *)entity byAttribute:(NSString *)attributeName inContext:(NSManagedObjectContext *)managedObjectContext
Declared In
RKInMemoryEntityCache.h
cachedObjectForEntity:withAttribute:value:inContext:
- (NSManagedObject *)cachedObjectForEntity:(NSEntityDescription *)entity withAttribute:(NSString *)attributeName value:(id)attributeValue inContext:(NSManagedObjectContext *)managedObjectContext
Declared In
RKInMemoryEntityCache.h
cachedObjectsForEntity:byAttribute:inContext:
Retrieves all objects within the cache
- (NSMutableDictionary *)cachedObjectsForEntity:(NSEntityDescription *)entity byAttribute:(NSString *)attributeName inContext:(NSManagedObjectContext *)managedObjectContext
Declared In
RKInMemoryEntityCache.h
expireCacheEntriesForEntity:
- (void)expireCacheEntriesForEntity:(NSEntityDescription *)entity
Declared In
RKInMemoryEntityCache.h
expireCacheEntryForObject:byAttribute:inContext:
- (void)expireCacheEntryForObject:(NSManagedObject *)managedObject byAttribute:(NSString *)attributeName inContext:(NSManagedObjectContext *)managedObjectContext
Declared In
RKInMemoryEntityCache.h
initWithManagedObjectContext:
Initializes the receiver with a managed object context containing the entity instances to be cached.
- (id)initWithManagedObjectContext:(NSManagedObjectContext *)managedObjectContext
Parameters
- context
The managed object context containing objects to be cached.
Return Value
self, initialized with context.
Declared In
RKInMemoryEntityCache.h