Hi, The application scope is useful for this kind of data (in moderation of course), but you should also minimise the number of writes you actually do to the application scope.
Hopefully (though the code does not indicate this), you should have a check to see if the array doesn't already exist in the application scope before creating it (ie. NOT structKeyExists(application,"rews")). Otherwise, every request will be resetting your array and you'll end up with lots of gremlins when multiple users are hitting the application at the same time. Personally if it just a simple array that gets created at the start of each request then I might want to set it in the request scope. Horses for courses Joel -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] Behalf Of Dale Fraser Sent: Friday, 17 November 2006 3:33 PM To: [email protected] Subject: [cfaussie] Re: Application scope problem I wouldn't use application scope for this level of data. You do need to lock all references to application as it's shared so you need to ensure only one page is modifying it at a time. Regards Dale Fraser http://dale.fraser.id.au -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Matthew Sent: Friday, 17 November 2006 15:15 PM To: cfaussie Subject: [cfaussie] Application scope problem Hi guys, I think I'm getting a corrupt application scope problem. The CF error is: -------- The element at position 3 cannot be found. LINE 411 -------- LINE 411 is: -------- #application.rews.timePeriods[X].name# (it's in a loop so X would have been equal to 3). -------- Application.cfm code: -------- application.rews.locale = "en_US"; application.rews.timePeriods = ArrayNew(1); application.rews.timePeriods[1] = StructNew(); application.rews.timePeriods[1].name = "00:00-06:00"; application.rews.timePeriods[1].period.low = "00:00"; application.rews.timePeriods[1].period.high = "06:00"; application.rews.timePeriods[2] = StructNew(); application.rews.timePeriods[2].name = "06:00-08:00"; application.rews.timePeriods[2].period.low = "06:00"; application.rews.timePeriods[2].period.high = "08:00"; application.rews.timePeriods[3] = StructNew(); application.rews.timePeriods[3].name = "08:00-10:00"; application.rews.timePeriods[3].period.low = "08:00"; application.rews.timePeriods[3].period.high = "10:00"; application.rews.timePeriods[4] = StructNew(); application.rews.timePeriods[4].name = "10:00-13:00"; application.rews.timePeriods[4].period.low = "10:00"; application.rews.timePeriods[4].period.high = "13:00"; application.rews.timePeriods[5] = StructNew(); application.rews.timePeriods[5].name = "13:00-17:00"; application.rews.timePeriods[5].period.low = "13:00"; application.rews.timePeriods[5].period.high = "17:00"; application.rews.timePeriods[6] = StructNew(); application.rews.timePeriods[6].name = "17:00-21:00"; application.rews.timePeriods[6].period.low = "17:00"; application.rews.timePeriods[6].period.high = "21:00"; application.rews.timePeriods[7] = StructNew(); application.rews.timePeriods[7].name = "21:00-24:00"; application.rews.timePeriods[7].period.low = "21:00"; application.rews.timePeriods[7].period.high = "23:59"; application.rews.timePeriodsDefault.departOption = 3; application.rews.timePeriodsDefault.returnOption = 6; application.rews.paxMax = 9; -------- I've just read this article (http://www.adobe.com/devnet/server_archive/articles/cf_locking_best_practic es.html) on locking read/write to application scoop, however the article seems old, is this still relevant? Note: the project I'm working on does not use application.cfc. Do I need to put application scope locking in place? There are 2650 refernece to this scope throughout the website! Perhaps it's not a locking issue, can anyone see any probs with the code? Cheers --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en -~----------~----~----~----~------~----~------~--~---
