• 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: Tips on Saving Data?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tips on Saving Data?


  • Subject: Re: Tips on Saving Data?
  • From: Matthew Cox <email@hidden>
  • Date: Tue, 2 Dec 2003 20:50:11 -0500

On Tuesday, December 2, 2003, at 02:24 PM, Demitri Muna wrote:

Hello,

I had a question that I posted last week but got no responses for (may have been the holidays). I'll recast it, but in a much shorter way.

Let's say you have an application like iTunes. What is the recommended strategy for saving changes to the library (where there is no "Save" command)? Presumably you would not save after every little change, but how often is good? Is there a way to minimize drive/CPU time? It there a file format that is preferable in this case?

You could log each change to a separate file, and then periodically move the changes from the log into the master file; this is kind of like journalling. This gives you several advantages:

-very fast to simply append data to the journal (no seeking within the file)

-the disk cache will take care of this file automagically if its is very active

-if your application crashes before the changes are written, you can play back this file to restore the changes the user made (be sure to check that an entry is sane before you apply it.

I can give you some pointers on crafting this scheme if you are interested.
_______________________________________________
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.
  • Prev by Date: Re: makeWindowControllers question
  • Next by Date: Re: makeWindowControllers question
  • Previous by thread: Re: Tips on Saving Data?
  • Next by thread: Re: Tips on Saving Data?
  • Index(es):
    • Date
    • Thread