• 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: WeakCache?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WeakCache?


  • Subject: Re: WeakCache?
  • From: j o a r <email@hidden>
  • Date: Mon, 28 Apr 2003 17:55:43 +0200

On Monday, Apr 28, 2003, at 16:56 Europe/Stockholm, petite_abeille wrote:

No, it will not magically do anything to the NSValue you keep. The value object is just an integer (or something similar) and does not have any real connection to the live object it points to.
Anyway to check for the validity of what nonretainedObjectValue is returning?

Not that I know of - and at least nothing that is easy or straight forward.

My suggestion is that you add a method to remove the object from the cache when it is being removed from the collection, either to the dealloc method of the object itself, or to the remove method in the controller.
I see... but if I need to proactively remove an object from a cache in dealloc, this creates a very unfortunate dependency between the object and its cache... something I would like to avoid altogether :/ Any idea about how to implement a generic weak cache mechanism which doesn't depends on any help from the objects it's holding to stay valid?

I still think you can find a design where it's perfectly OK to let the cache know that an object is about to be removed, be it via notifications, direct methods or by the controller / owner of the object in question. Think outside of the box!

j o a r
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: WeakCache?
      • From: petite_abeille <email@hidden>
References: 
 >Re: WeakCache? (From: petite_abeille <email@hidden>)

  • Prev by Date: Re: WeakCache?
  • Next by Date: More directory madness
  • Previous by thread: Re: WeakCache?
  • Next by thread: Re: WeakCache?
  • Index(es):
    • Date
    • Thread