CoreData and image caching
CoreData and image caching
- Subject: CoreData and image caching
- From: Steve Israelson <email@hidden>
- Date: Fri, 8 Jun 2007 13:05:46 -0700
I have a CoreData object graph where each of my objects contains a
list of URL's that point to media files stored in a media directory.
I have a table with an NSImageView in one column bound to this url
attribute.
This works well except that the table is VERY slow in drawing, like
when scrolling etc.
I must assume this is either because the NSImage is very big and
being scaled all the time, or it is being re-loaded all the time.
What I am contemplating is sub-classing nsmanaged object and adding a
new attribute to my object called "thumbNail" and then binding this
to the table. This thumbNail has a type of NSImage.
When I get asked for the thumbNail image, if it is nil, I will ask
the object for the url, load an NSImage of some smaller size, and use
that.
I think this will work fine.
Now, one other thing I was contemplating was adding some sort of best-
before date in there and periodically release all these images that
have not been used in a while to save on ram usage. Is there some
well known way to go about this? Or should I just let the VM handle it?
I am expecting on the order of 10,000 images max and probably 1,000
would be normal.
Not all the items with images will show up in the table, so maybe 200
or more would actually be loaded at minimum.
Does this seem like a good way to go, or is there better ways to do
this?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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