RE: Yet another CFLOCK question.......
Dave, Please help! This whole concept of for application and session variables has me totally stumped. I am using CF 4.01 application server and can't seem to get my mind around the concept. As I understand it (from CF WACK 4.0) application variables are used when an application need only set it once then read it often. Such as Setting the DSN name (application.dsn="somedatabase") or a base reference application.basref=http://mydomain.com/ in the applicationcfm file, and session variables are user specific storage like setting and reading the user ID for that session. Application variables are available to every session but session variables are available only to their session. OK, Now my question is: If I only set the application variable once on startup and only read it throughout the application why is it necessary to every read of the variable? Doesn't this defeat the purpose of setting it once for all sessions then reading it often? If you have to cflock each read, what is the value of the application scope? Why not use standard variables set in the Application.cfm file since you don't need to cflock them? I am absolutely sure I am totally misunderstanding something. Can you help this poor soul? Best Regards, Dennis Powers UXB Internet (203)879-2844 http://www.uxbinfo.com -Original Message- From: Dave Watts [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 04, 2000 3:01 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: Yet another CFLOCK question... -- Archives: http://www.eGroups.com/list/cf-talk To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: Yet another CFLOCK question.......
> I have an Application variable with info about the database > (DSNName, UserName etc). The variable is a struct and some > of the keys are structs themselfs. When i talk to the databse > i use a set of CustomTags, to witch i send the Application > varibel as an attribute. > > For example > >UserID="343" > stDatabase="#Application.stDatabase#"> > > Do i have to lock the call to the CustomTag ? Yes, you must. In your example, by referencing Application.stDatabase, you're passing it by reference to the custom tag, meaning that the custom tag, when it references any of the values Attributes.stDatabase contains, will be referencing the Application structure itself - and in fact, the custom tag could write to the Application scope by referencing Attributes.stDatabase, so you may need to place an exclusive lock. If you wanted to avoid placing an exclusive lock, you could get away with using a readonly lock by doing this: Of course, if you knew that the custom tag doesn't modify the contents of Application.stDatabase, you could use a readonly lock. If you wanted to avoid placing any lock at all on the custom tag, you could do this: If you wanted to avoid locking the custom tag, and didn't want to duplicate the stDatabase structure, you could reference the individual members of the structure from within the custom tag, and lock those references. Your custom tag would then have to refer to the data directly from within the Application scope, rather than have it passed in as an attribute. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 -- Archives: http://www.eGroups.com/list/cf-talk To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: Yet another CFLOCK question.......
Hi Ruben, If you turn on Full Checking in your CFAdmin, you will have to CFLOCK each APPLICATION, SERVER and SESSION Variables you try to access, either in read-only or exclusive. I talked to Allaire, and this is the good way to handle these variables (APP, SERVER and SESSION), since they are shared for all user in memory (even SESSION variables.) So first of all, when I use APPLICATION variables, I always CFLOCK these, and then I pass them to the REQUEST scope, which can be accessed from anywhere during the excution of a template (i.e. if a CustomTag is called, he will be able to access the REQUEST variable, even though it was been set in the caller template). You do not CFLOCK the whole custom tag. Naturally, this is making the APPLICATION variables pretty useless, since you should always CFLOCK your APPLICATION variables in order to access them. So the only reason you would need application variables is to store "complex" structures of data (i.e. recordset of a query). Then if you would have to CFLOCK your APPLICATION variable to pass it to the REQUEST scope. In case of a Struct, you will need to StructCopy it, since a simple affectation only points to it. If you have any problem with what I'm trying to say, write me personnally, and I'll try to help you. Frédéric LeMieux ([EMAIL PROTECTED]) -- Archives: http://www.eGroups.com/list/cf-talk To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.