• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Odd NSCache Eviction Behaviour
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Odd NSCache Eviction Behaviour


  • Subject: Re: Odd NSCache Eviction Behaviour
  • From: Graham Cox <email@hidden>
  • Date: Tue, 05 Apr 2011 22:16:39 +1000

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@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

  • Follow-Ups:
    • Re: Odd NSCache Eviction Behaviour
      • From: Dalmazio Brisinda <email@hidden>
References: 
 >Odd NSCache Eviction Behaviour (From: Dalmazio Brisinda <email@hidden>)
 >Re: Odd NSCache Eviction Behaviour (From: Ken Thomases <email@hidden>)
 >Re: Odd NSCache Eviction Behaviour (From: Dalmazio Brisinda <email@hidden>)

  • Prev by Date: Re: Passing an object to a custom sheet
  • Next by Date: Re: Trying to subclass UISwitch
  • Previous by thread: Re: Odd NSCache Eviction Behaviour
  • Next by thread: Re: Odd NSCache Eviction Behaviour
  • Index(es):
    • Date
    • Thread