Re: NSInMemoryStoreType: Not really "persistent", is it?
Re: NSInMemoryStoreType: Not really "persistent", is it?
- Subject: Re: NSInMemoryStoreType: Not really "persistent", is it?
- From: Bill Bumgarner <email@hidden>
- Date: Tue, 21 Oct 2008 16:53:18 -0700
On Oct 21, 2008, at 4:43 PM, Jerry Krinock wrote:
An NSPersistentStore created with NSInMemoryStoreType is in volatile
RAM or VM, and is therefore not what I would call "persistent". So,
why is it an NS^Persistent^Store?
My guess is that NSInMemoryStoreType was added too late in the
development of Core Data to change the names of the NS___Store and
NS___StoreCoordinator.
Is there a better explanation?
(I'm just trying to understand the terms here.)
Well, it is persistent. Just don't turn off your machine or shut down
the app.
In all seriousness, a persistent store the interface between the
coordinator and the permanent state of your object graph -- both for
reading and writing. When you push a change into a store, that change
effectively becomes a permanent part of that objects state. That the
actual storage is in memory vs. on disk is irrelevant.
The in memory store is actually extremely useful for caches and as a
backing store for applications that read/write to/from some kind of
server -- typically an XML RPC of some type -- that wants to take full
advantage of CD's object graph management infrastructure. The various
change hooks on the MOC and coordinator make it possible to easily
mirror the changes out to the wire protocol or update the local cache
-- the in memory persistent store -- with changes pulled from the
other side.
(I did a little demo app at one point long ago that used an in memory
store to cache results from Amazon's web services API. The front end
was all pure Cocoa / bindings / CD with a minimal amount of additional
code to pull data from amazon and push it into the local store).
b.bum
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden