On 05/04/2011, at 7:01 PM, Dalmazio Brisinda wrote:

> Pity. NSCache looked so promising


You could roll your own cache class that has the same interface but uses a LRU 
algorithm internally. Then if NSCache is updated it would be a drop-in 
replacement. The only drawback with it at present (which might be considered 
rather major) is that there's no straightforward way to hook your own cache 
objects into the runtime such that it would automatically cause eviction when 
memory pressure is tight. On iOS I believe there is a hook for responding to 
low memory, but on Mac OS there isn't, unfortunately. The best you can do is to 
set some sort of high water mark limit that evicts the LRU objects whenever the 
cache is accessed. Doing that is obviously pretty straightforward.

--Graham


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to