House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Flushing Application scoped vars

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Have you tried
Joe Eugene
07/23/02 10:55 A
Hi
Kola Oyedeji
07/23/02 11:20 A
Jason,
Mark A. Kruger - CFG
07/23/02 11:21 A
<cfscript>
Tipton Josh (orl1jdt)
07/23/02 11:36 A
Isaac,
WebMaster
07/23/02 02:16 P
> Isaac,
S. Isaac Dealey
07/23/02 03:01 P
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dowdell, Jason G
07/23/2002 09:40 AM

Does anyone know of a good way to flush the vars stored in the application scope?  I tried setting the applicationtimeout to CreateTimeSpan(0,0,0,0) and that didn't do anything.  I'm not sure how cfflush works but I think that has to do with headers and not with ColdFusion cacheing.  Anyway, if any of you has a good tip for this I'd appreciate it. Thanks, Jason <!---      Jason Dowdell      dowdeljg@usano.ksc.nasa.gov      321.799.6845      IM AES - Web Developer --->

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Joe Eugene
07/23/2002 10:55 AM

Have you tried <CFAPPLICATION NAME="YourAppName" SESSIONTIMEOUT="#CreateTimeSpan(0,0,0,0)#" APPLICATIONTIMEOUT="#CreateTimeSpan(0,0,0,0)#"> This should work Joe > Does anyone know of a good way to flush the vars stored in the application > scope?  I tried setting the applicationtimeout to CreateTimeSpan(0,0,0,0) > and > that didn't do anything.  I'm not sure how cfflush works but I think that > has to > do with headers and not with ColdFusion cacheing.  Anyway, if any of you has ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Kola Oyedeji
07/23/2002 11:20 AM

Hi Hi I think the application scope may be stored internally as a structure so perhaps trying a structclear would achieve this? Also not sure if the presence of cfid and cftoken on the clients machine may still cause the application to persist. Kola Does anyone know of a good way to flush the vars stored in the application scope?  I tried setting the applicationtimeout to CreateTimeSpan(0,0,0,0) and that didn't do anything.  I'm not sure how cfflush works but I think that has to do with headers and not with ColdFusion cacheing.  Anyway, if any of you has a good tip for this I'd appreciate it. Thanks, Jason <!---      Jason Dowdell      dowdeljg@usano.ksc.nasa.gov      321.799.6845      IM AES - Web Developer --->

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Haggerty, Mike
07/23/2002 11:21 AM

Since variables in the application scope are stored as a session, I suppose you could do something like this: <cfset temp = structkeylist(application)> <cfloop list="#temp#" index="dex">   <cfset temp2 = structdelete(application, dex)> </cfloop> This will remove all variables from the application scope. M Does anyone know of a good way to flush the vars stored in the application scope?  I tried setting the applicationtimeout to CreateTimeSpan(0,0,0,0) and that didn't do anything.  I'm not sure how cfflush works but I think that has to do with headers and not with ColdFusion cacheing.  Anyway, if any of you has a good tip for this I'd appreciate it. Thanks, Jason <!---      Jason Dowdell      dowdeljg@usano.ksc.nasa.gov      321.799.6845      IM AES - Web Developer --->

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dave Carabetta
07/23/2002 11:21 AM

----- Excess quoted text cut - see Original Post for more ----- Since the APPLICATION scope is a structure, just use StructClear(APPLICATION), and that will do it. Regards, Dave.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Mark A. Kruger - CFG
07/23/2002 11:21 AM

Jason, You could loop through the scope (it's a structure) and delete the keys - they would be instantiated on the next request.  Note: if you have to do this routinely then you are probably using the wrong scope.  the Ap scope should be reserved for data that changes very rarely (like lookup queries or Datasource names). -mk Mark A. Kruger, MCSE, CFG www.cfwebtools.com www.necfug.com ...no more brochures! Does anyone know of a good way to flush the vars stored in the application scope?  I tried setting the applicationtimeout to CreateTimeSpan(0,0,0,0) and that didn't do anything.  I'm not sure how cfflush works but I think that has to do with headers and not with ColdFusion cacheing.  Anyway, if any of you has a good tip for this I'd appreciate it. Thanks, Jason <!---      Jason Dowdell      dowdeljg@usano.ksc.nasa.gov      321.799.6845      IM AES - Web Developer --->

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Tipton Josh (orl1jdt)
07/23/2002 11:36 AM

<cfscript> structclear(application); structclear(session); </cfscript> Does anyone know of a good way to flush the vars stored in the application scope?  I tried setting the applicationtimeout to CreateTimeSpan(0,0,0,0) and that didn't do anything.  I'm not sure how cfflush works but I think that has to do with headers and not with ColdFusion cacheing.  Anyway, if any of you has a good tip for this I'd appreciate it. Thanks, Jason <!---      Jason Dowdell      dowdeljg@usano.ksc.nasa.gov      321.799.6845      IM AES - Web Developer --->

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dowdell, Jason G
07/23/2002 11:54 AM

This is actually a shopping cart structure that displays the items in each category, subcategory or brand.  The structure only gets deleted if the owner of the store updates the database of products and then I set a flag.  I knew about deleting and clearing the structure but it wasn't working.  I think my problem was that I didn't get rid of the cookies on my machine but I'm checking that now. ~Jason Jason, You could loop through the scope (it's a structure) and delete the keys - they would be instantiated on the next request.  Note: if you have to do this routinely then you are probably using the wrong scope.  the Ap scope should be reserved for data that changes very rarely (like lookup queries or Datasource names). -mk Mark A. Kruger, MCSE, CFG www.cfwebtools.com www.necfug.com ..no more brochures! Does anyone know of a good way to flush the vars stored in the application scope?  I tried setting the applicationtimeout to CreateTimeSpan(0,0,0,0) and that didn't do anything.  I'm not sure how cfflush works but I think that has to do with headers and not with ColdFusion cacheing.  Anyway, if any of you has a good tip for this I'd appreciate it. Thanks, Jason <!---      Jason Dowdell      dowdeljg@usano.ksc.nasa.gov      321.799.6845      IM AES - Web Developer --->

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Mark A. Kruger - CFG
07/23/2002 02:42 PM

Yeah - I do it this way sometimes (holding a lookup query of inventory for example).  Some times I do something like this: <cfif NOT IsDefined('application.*somekey*') OR IsDefined('url.forceRefresh')>   <cflock scope="application" timeout="10">     <cfquery name="application.Inventory" datasource="MyDsn">       SELECT * FROM inventory_table     </cfquery>   </cflock> </cfif> Then, I (or even my client) can just hit any page in the ap with ?forcerefresh=true appended to the URL - and viola! the application vars are refreshed. -mk This is actually a shopping cart structure that displays the items in each category, subcategory or brand.  The structure only gets deleted if the owner of the store updates the database of products and then I set a flag.  I knew about deleting and clearing the structure but it wasn't working.  I think my problem was that I didn't get rid of the cookies on my machine but I'm checking that now. ~Jason Jason, You could loop through the scope (it's a structure) and delete the keys - they would be instantiated on the next request.  Note: if you have to do this routinely then you are probably using the wrong scope.  the Ap scope should be reserved for data that changes very rarely (like lookup queries or Datasource names). -mk Mark A. Kruger, MCSE, CFG www.cfwebtools.com www.necfug.com .no more brochures! Does anyone know of a good way to flush the vars stored in the application scope?  I tried setting the applicationtimeout to CreateTimeSpan(0,0,0,0) and that didn't do anything.  I'm not sure how cfflush works but I think that has to do with headers and not with ColdFusion cacheing.  Anyway, if any of you has a good tip for this I'd appreciate it. Thanks, Jason <!---      Jason Dowdell      dowdeljg@usano.ksc.nasa.gov      321.799.6845      IM AES - Web Developer --->

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dowdell, Jason G
07/23/2002 11:54 AM

Man I hate that, it was the data.  There was data corruption in the database and that screwed it all up. thanks guys, Jason ----- Excess quoted text cut - see Original Post for more ----- Since the APPLICATION scope is a structure, just use StructClear(APPLICATION), and that will do it. Regards, Dave.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
S. Isaac Dealey
07/23/2002 01:15 PM

----- Excess quoted text cut - see Original Post for more ----- <cfflush> is only indirectly related to headers -- it tells the cfserver to send whatever portion of the page has completed to the browser before continuing processing the page, so the browser gets the page incrementally... The relationship to headers is that you cant use anything on the page after a cfflush tag that would alter the headers like cfheader, cflocation and I think cfcookie and possibly cfform. As to your question, try this: <cflock scope="application" type="exclusive" timeout="10">   <cfscript>     temp = application.applicationname;     StructClear(application);     application.applicationname = temp;   </cfscript> </cflock> That should give you a clean-slate, just as tho the <cfapplication> tag had just been processed for the first time. Isaac Dealey www.turnkey.to 954-776-0046

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
S. Isaac Dealey
07/23/2002 01:17 PM

> the Ap scope should be reserved for data that changes > very rarely (like ...<snip>... Datasource names). ICK! ... I had to clean up someone else's mess recently with this -- they used application variables for all their db accessing variables ( dsn, username and password ) and with zero locking on a heavily trafficked CF5 server... which of course, caused problems... I replaced them all with request variables, which solved the problem. Isaac Dealey www.turnkey.to 954-776-0046

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
S. Isaac Dealey
07/23/2002 01:18 PM

----- Excess quoted text cut - see Original Post for more ----- I did this once ... You have to make sure you copy the applicationname into a temp variable and then copy it back into thea applicationscope afterward on the same page... I'm not real certain why, but you get an error on the next page otherwise ... or at least that was the result I got... Isaac Dealey www.turnkey.to 954-776-0046

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
WebMaster
07/23/2002 02:16 PM

Isaac,   What is wrong with using application scope to hold the user name and password? ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
S. Isaac Dealey
07/23/2002 03:01 PM

> Isaac, >   What is wrong with using application scope > to hold the [cfquery] user name and password? There's nothing necessarily wrong with it per se ... The problem here in particular was that there wasn't any use of <cflock> in the application on a heavily trafficked CF5 server, which caused server instability ... So the options were to either read-lock the application scope on every one of several hundred cfqueries or simply replace "application" with "request" in the cfset tags and then again in all the queries ... the latter solution is _MUCH_ less code, much easier to do to fix the problem, and probably better performance as well, since it eliminates the problem of the machine waiting for any pages loading queries to finish with the db before being able to instantiate an exclusive lock to set the application variable equal to what it's already equal to anyway. :) I could have even set a request variable equal to the application variable on each page request, but even that would have been gratuitous code / locking. My inclination is to think that in the majority of applications ( well, it has been in all the applications I've ever worked on ) that the data accessing variables used for cfquery and cfstoredproc tags are defined only once in either the application.cfm or the fbx_settings ( or equivalent fusebox2 module ) ... at which point, the code which generates these variables is going to be included on every page request anyway, so using the application scope to store it is gratuitous unless you plan to change these variables on the fly, _without_ editing the application.cfm or fbx_settings.cfm file... I can _imagine_ situations in which someone might want to do this, but I've never worked with one. Isaac Dealey www.turnkey.to 954-776-0046


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

October 25, 2014

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference