If your data is small, I'd just live with 1!:2 <'filename' Memory mapped files can be fun to work with, but I don't see any advantages for a situation like this.
Thanks, -- Raul On Sun, Nov 16, 2014 at 2:10 AM, 'Pascal Jasmin' via Programming <[email protected]> wrote: > Let's say I'd like to keep 5 data items as "permanent" accross program > restarts. They change frequently. For example counters that are used as > keys for next table records. > > Is keeping these counters in a memory mapped file, recommended? The nature > of the counters is that they just need to never be reused, so they are > incremented when read, and it is no big deal if there is a perfectly timed > power outtage that doesn't cause the counter to be incremented, because that > power outtage would also prevent the retrieved value from being used. > > It would also not be a major problem (though still not desirable) if the file > became corrupted, because there is a procedure that can find the last counter > (though it is more expensive than typical database apps of looking at the > last record). > > What would be a major problem is if there is a lazyness to the writing of > memory mapped files such that the retrieved counter value can be used without > any guarantee that the file will be updated... that is if a power failure > could occur 1 second or so after the memory mapped variable is updated, but > the file would not be. > > If using memory mapped files this way is recommendable, is it best to used > separate files for each (handful of) variable or a single file? > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
