Locking (was RE: Structures, Arrays, and WDDX oh my)

2000-08-25 Thread Sharon DiOrio

There have been a couple of detailed discussions on this list about locking,
but I'll give you a quick synopsis.

CF introduced the concept of locking variables to prevent multiple
read/writes of the same variable.  Three scopes are affected: SESSION,
APPLICATION and SERVER.  Basically you need to use cflock around any reads
or writes of these variables.  CF doesn't explicitly require this (unless
you turn on the option to throw errors on unlocked variables in the cfadmin)
but it does a lot for application stability.

!--- on write ---
cflock scope="application" type="exclusive" timeout="10"
cfset APPLICATION.myVar = "some Value"
/cflock

!--- then on read ---
cflock scope="application" type="readonly" timeout="10"
cfoutput#APPLICATION.myVar#/cfoutput
/cflock

I've found that copying variables to REQUEST scope (a scope available to any
template - including custom tags - processed during a *single* request) at
the beginning of any template that uses them (and copying them back, if they
were changed by the template) to be the most efficient way of doing this.

Sharon

-Original Message-
From: Milks, Jim [EMAIL PROTECTED]
To: '[EMAIL PROTECTED]' [EMAIL PROTECTED]
Date: Friday, August 25, 2000 3:30 PM
Subject: Sharon - RE: Structures, Arrays, and WDDX oh my


Hi Sharon,
I was wondering if you could elaborate on your statement:

You should also know that you can save these complex data types (arrays,
structures, queries) to scoped variables like SESSION and APPLICATION (with
proper locking, of course.)

I too recently started using structures as session and application
variables, but did not use any explicit locking. How is this done?

JM

-Original Message-
From: Sharon DiOrio
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: 25/08/00 3:14 PM
Subject: Re: Structures, Arrays, and WDDX oh my

Do not limit your usage of structures and arrays based on memory
concerns.
Spectra makes *heavy* use of both in the realm way beyond what the
average
CF user would even think of attempting.  I have a couple of applications
with structures nested 8 layers deep with thousands of records with no
visible impact on memory.

You should also know that you can save these complex data types (arrays,
structures, queries) to scoped variables like SESSION and APPLICATION
(with
proper locking, of course.)

I don't know anything about deleting all structures on a server, but if
you
run a "structClear()" on a scope (SESSION, SERVER, APPLICATION) it will
wipe
out all variables stored in that scope because the scopes are actually
structures.   structDelete() will delete one key from a structure.

I also recommend to anyone playing with complex datatypes to either
download
cf_objectDump from the tag gallary, or if you have Spectra, using
cfa_dump to visually "see" your structures, arrays, etc.

Sharon

-Original Message-
From: Robert Everland [EMAIL PROTECTED]
To: '[EMAIL PROTECTED]' [EMAIL PROTECTED]
Date: Friday, August 25, 2000 2:59 PM
Subject: Structures, Arrays, and WDDX oh my


 Alright I am going to start using structures and arrays and turn
them to wddx so I don't have to rely on hidden form fields anymore. Now
the
question I have is, when I use a structure and/or array how much memory
does
it take? I know I can delete structures but I remember seeing that some
people would have problems when doing a structure delete all(don't know
exact sytax on hand) and it would delete all structures on the machine?
Is
this still a   problem and if so how would I overcome it.


Robert Everland III
Web Developer
Dixon Ticonderoga
---

---
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
or
send a message to [EMAIL PROTECTED] with 'unsubscribe'
in
the body.


--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
or send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body.
---
---
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: Locking (was RE: Structures, Arrays, and WDDX oh my)

2000-08-25 Thread Philip Meadows

Here's an article by Ben Forta on the very subject of locking vars:

http://www.sys-con.com/coldfusion/archives/0208/forta/

Philip

--snip--

I too recently started using structures as session and application
variables, but did not use any explicit locking. How is this done?

JM
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.