CFC is server scope and session calls to it...
Hi! Question, I have several cfc's stored in server scope ( yes, I own server and it is for a intranet and I use vars ) that are the guts of my app. I have a pretty clear understanding of how things work except one situation. When a call is made to a method with arguments passed in, currently I am passing in my session.user.ident ( where I store the user identity ) explicitly. I was wondering if I am able to reference the session scope implicitly in the cfc method directly without causing erroneous user.idents references. I would assume that I would have to do a lock? What kind? Or is it better to pass in the session directly into the cfc method using the arguments? Am I making sense? lol Thanks. ~| Upgrade to Adobe ColdFusion MX7 The most significant release in over 10 years. Upgrade see new features. http://www.adobe.com/products/coldfusion?sdid=RVJR Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284271 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: CFC is server scope and session calls to it...
I would, if at all possible for designs sake pass in the session data as an argument and to not use / explicitly reference the session scope within. This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant, Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business, Registered in England, Number 678540. It contains information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you have received this communication in error please return it to the sender or call our switchboard on +44 (0) 20 89107910. The opinions expressed within this communication are not necessarily those expressed by Reed Exhibitions. Visit our website at http://www.reedexpo.com -Original Message- From: John Skrotzki To: CF-Talk Sent: Fri Jul 20 22:45:39 2007 Subject: CFC is server scope and session calls to it... Hi! Question, I have several cfc's stored in server scope ( yes, I own server and it is for a intranet and I use vars ) that are the guts of my app. I have a pretty clear understanding of how things work except one situation. When a call is made to a method with arguments passed in, currently I am passing in my session.user.ident ( where I store the user identity ) explicitly. I was wondering if I am able to reference the session scope implicitly in the cfc method directly without causing erroneous user.idents references. I would assume that I would have to do a lock? What kind? Or is it better to pass in the session directly into the cfc method using the arguments? Am I making sense? lol Thanks. ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284272 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: CFC is server scope and session calls to it...
Definitely I would either just pass the entire user object in or use a session facade to instantiate the user ubject from within the server scoped CFC. The primary reason I would choose one over the other would be that explicitly passing in the user object would allow you to potentially pass in ANY user object (logged in user or not), while using a session facade pretty much will tightly couple that server scope CFC to the logged in user and you will have to refactor to allow it to support other user objects. -Cameron Robertson-Ravo, Neil (RX) wrote: I would, if at all possible for designs sake pass in the session data as an argument and to not use / explicitly reference the session scope within. -Original Message- From: John Skrotzki To: CF-Talk Sent: Fri Jul 20 22:45:39 2007 Subject: CFC is server scope and session calls to it... Hi! Question, I have several cfc's stored in server scope ( yes, I own server and it is for a intranet and I use vars ) that are the guts of my app. I have a pretty clear understanding of how things work except one situation. When a call is made to a method with arguments passed in, currently I am passing in my session.user.ident ( where I store the user identity ) explicitly. I was wondering if I am able to reference the session scope implicitly in the cfc method directly without causing erroneous user.idents references. I would assume that I would have to do a lock? What kind? Or is it better to pass in the session directly into the cfc method using the arguments? Am I making sense? lol Thanks. ~| Macromedia ColdFusion MX7 Upgrade to MX7 experience time-saving features, more productivity. http://www.adobe.com/products/coldfusion?sdid=RVJW Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284273 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: CFC is server scope and session calls to it...
Hi! Question, I have several cfc's stored in server scope ( yes, I own server and it is for a intranet and I use vars ) that are the guts of my app. I have a pretty clear understanding of how things work except one situation. When a call is made to a method with arguments passed in, currently I am passing in my session.user.ident ( where I store the user identity ) explicitly. I was wondering if I am able to reference the session scope implicitly in the cfc method directly without causing erroneous user.idents references. I would assume that I would have to do a lock? What kind? Or is it better to pass in the session directly into the cfc method using the arguments? Am I making sense? Lol I'm not sure what you mean exactly by passing session.user.ident explicitly, but I assume that you mean something like this: cfset myval = Server.mycfc.mymethod(Session.user.ident) That would be strongly preferable to referencing the Session scope directly within your CFC instance, since doing so tightly couples your component to its caller. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! This email has been processed by SmoothZap - www.smoothwall.net ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284274 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: CFC is server scope and session calls to it...
Thanks all, that is what I figured just wanted to make sure my thinking was on the right path and a small part want to see if I could be a bit lazy lol. ~| CF 8 â Scorpio beta now available, easily build great internet experiences â Try it now on Labs http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284277 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: SERVER scope
Hi, Why is it frowned upon by the way? I've heard such talk before, that's why I ask, but I'm not sure of the reasons. one reason was the shared variables issue on CF 5 and before (concurrent requests). But, another point is that on a shared server you have no way to make sure another programmer is not using the same variable name, thus overwriting your var. Finally, in OO architectures, shared scope variables (plus request variables) are frowned upon, because they violate encapsulation. I think I remember a thread where somebody said that using request variables in a OO architecture should be avoided at all costs... (which in my personal opinion is not true, because at all costs _never_ makes sense in programming... ;-)) If you have your own CF instance and can make sure that a variable of the same is not created anywhere else, you should not have a problem with server variables as long as you don't do OO that is. ;-) Best, Chris ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232897 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: SERVER scope
Baz, Mainly, the server scope needs to contain things that are germane to the entire server. It's probably frowned on because folks would put things in the server scope that belong in the application scope - like DSN names or settings for example. -Mark -Original Message- From: Baz [mailto:[EMAIL PROTECTED] Sent: Sunday, February 19, 2006 8:52 PM To: CF-Talk Subject: RE: SERVER scope Thanks guys, Why is it frowned upon by the way? I've heard such talk before, that's why I ask, but I'm not sure of the reasons. Baz -Original Message- From: Mark A Kruger [mailto:[EMAIL PROTECTED] Sent: Sunday, February 19, 2006 5:41 PM To: CF-Talk Subject: RE: SERVER scope If as you say this library is server wide then I say go for it :) But make sure and check to see if it already exists and only instantiate it once - othewise whats' the point? -mark -Original Message- From: Baz [mailto:[EMAIL PROTECTED] Sent: Sunday, February 19, 2006 4:25 PM To: CF-Talk Subject: SERVER scope Hi, I have a CFC that I use across all applications. It's basically a global UDF library that stores no data. Is it ok to store this CFC in the SERVER scope rather than the application scope? Is using a named lock for this ok: cflock name=ServerUtils type=exclusive cfset Server.Utils=createObject('Component','SystemUtils') / /cflock Cheers, Baz ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232922 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
SERVER scope
Hi, I have a CFC that I use across all applications. It's basically a global UDF library that stores no data. Is it ok to store this CFC in the SERVER scope rather than the application scope? Is using a named lock for this ok: cflock name=ServerUtils type=exclusive cfset Server.Utils=createObject('Component','SystemUtils') / /cflock Cheers, Baz ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232876 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: SERVER scope
I do, but it's usually frowned upon (for no logical reason). Just make sure you check if the var exists first before adding it to avoid unnecessary writing to the server scope, but even that is nothing to worry about as there is no 'real' storage difference between the server, application and session scopes (or any scope for that matter) other than how it's accessed. Hi, I have a CFC that I use across all applications. It's basically a global UDF library that stores no data. Is it ok to store this CFC in the SERVER scope rather than the application scope? Is using a named lock for this ok: cflock name=ServerUtils type=exclusive cfset Server.Utils=createObject('Component','SystemUtils') / /cflock Cheers, Baz ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232877 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: SERVER scope
If as you say this library is server wide then I say go for it :) But make sure and check to see if it already exists and only instantiate it once - othewise whats' the point? -mark -Original Message- From: Baz [mailto:[EMAIL PROTECTED] Sent: Sunday, February 19, 2006 4:25 PM To: CF-Talk Subject: SERVER scope Hi, I have a CFC that I use across all applications. It's basically a global UDF library that stores no data. Is it ok to store this CFC in the SERVER scope rather than the application scope? Is using a named lock for this ok: cflock name=ServerUtils type=exclusive cfset Server.Utils=createObject('Component','SystemUtils') / /cflock Cheers, Baz ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232878 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: SERVER scope
Thanks guys, Why is it frowned upon by the way? I've heard such talk before, that's why I ask, but I'm not sure of the reasons. Baz -Original Message- From: Mark A Kruger [mailto:[EMAIL PROTECTED] Sent: Sunday, February 19, 2006 5:41 PM To: CF-Talk Subject: RE: SERVER scope If as you say this library is server wide then I say go for it :) But make sure and check to see if it already exists and only instantiate it once - othewise whats' the point? -mark -Original Message- From: Baz [mailto:[EMAIL PROTECTED] Sent: Sunday, February 19, 2006 4:25 PM To: CF-Talk Subject: SERVER scope Hi, I have a CFC that I use across all applications. It's basically a global UDF library that stores no data. Is it ok to store this CFC in the SERVER scope rather than the application scope? Is using a named lock for this ok: cflock name=ServerUtils type=exclusive cfset Server.Utils=createObject('Component','SystemUtils') / /cflock Cheers, Baz ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232884 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: SERVER scope
I'd bet money that the issue was a pre-mx one. If you remember in CF 5, there was the issue of locking of memory variables and corruption of them if not done. This is not a case in MX so it should not be a problem. Actually, this is a plug for CFObjective and CFUnited where there will be people talking about creating CFC factories to control CFCs that will be used across applications. I'd use something like that in this case. Thanks guys, Why is it frowned upon by the way? I've heard such talk before, that's why I ask, but I'm not sure of the reasons. Baz -Original Message- From: Mark A Kruger [mailto:[EMAIL PROTECTED] Sent: Sunday, February 19, 2006 5:41 PM To: CF-Talk Subject: RE: SERVER scope If as you say this library is server wide then I say go for it :) But make sure and check to see if it already exists and only instantiate it once - othewise whats' the point? -mark -Original Message- From: Baz [mailto:[EMAIL PROTECTED] Sent: Sunday, February 19, 2006 4:25 PM To: CF-Talk Subject: SERVER scope Hi, I have a CFC that I use across all applications. It's basically a global UDF library that stores no data. Is it ok to store this CFC in the SERVER scope rather than the application scope? Is using a named lock for this ok: cflock name=ServerUtils type=exclusive cfset Server.Utils=createObject('Component','SystemUtils') / /cflock Cheers, Baz ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232888 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: SERVER scope in CF Enterprise
If you're running CF Enterprise with sandboxes, does the SERVER scope still apply to the entire server or dos each sandbox have its own SERVER scope? I'm pretty sure that you still only have one Server scope with sandboxes. You would have separate Server scopes if you used separate CFMX instances. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228151 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
SERVER scope in CF Enterprise
Hi, If you're running CF Enterprise with sandboxes, does the SERVER scope still apply to the entire server or dos each sandbox have its own SERVER scope? Cheers, Baz ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228116 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: SERVER scope in CF Enterprise
Sandboxes don't change the way scopes apply - they only introduce security checking via the java security methods; there remains a single SERVER scope common across all sandboxes. However, multiple instances of CF on the one machine will each have their own SERVER scope, because each instance runs in its own JVM. On 1/2/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, If you're running CF Enterprise with sandboxes, does the SERVER scope still apply to the entire server or dos each sandbox have its own SERVER scope? -- CFAJAX docs and other useful articles: http://jr-holmes.coldfusionjournal.com/ ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228117 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Server Scope
A few questions: Is it good practice or wise to create an object in the server scope? And if so how long does it live? I see in the administrator Memory Variables you can set the application and Session time to live, but not server scope. What I want to do. cfif (not structKeyExists(server, MyPalAuth)) or isdefined(url.Flush) cflock name=Lock_MyPalAuth timeout=5 type=EXCLUSIVE cfobject name=Server.MyPalAuth component=mycoms.MyPalAuth /cflock /cfif I read this from Ben's new Advanced Macromedia ColdFusion MX 7 Application Development book. But he used Application scope. I want the object to be created once on our intranet and then invoke it when needed in more then one application. I could place it in the application scope, but then that would mean for each application I would have to recreate the object. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206313 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Server Scope
Till the server reboots... it doesn't have a lifespan setting other than I'll be here till the server reboots. You could use any number of mechanisms to refresh it... As far as whether or not to create a CFC instance in the server scope there's no reason not to. You need to be aware of various conflicts that might occur... so I'd recommend named locks around any code that alters the data if there's a chance that more than one actor will try to alter the data. Basically, all the scopes are there to be used... my philosophy is to use them (except client... outside very specific circumstances.) Laterz, J On 5/10/05, David Brown [EMAIL PROTECTED] wrote: A few questions: Is it good practice or wise to create an object in the server scope? And if so how long does it live? I see in the administrator Memory Variables you can set the application and Session time to live, but not server scope. What I want to do. cfif (not structKeyExists(server, MyPalAuth)) or isdefined(url.Flush ) cflock name=Lock_MyPalAuth timeout=5 type=EXCLUSIVE cfobject name=Server.MyPalAuth component=mycoms.MyPalAuth /cflock /cfif I read this from Ben's new Advanced Macromedia ColdFusion MX 7 Application Development book. But he used Application scope. I want the object to be created once on our intranet and then invoke it when needed in more then one application. I could place it in the application scope, but then that would mean for each application I would have to recreate the object. -- --- - Buy SQLSurveyor! http://www.web-relevant.com/sqlsurveyor Never make your developers open Enterprise Manager again. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206317 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Server Scope
A few questions: Is it good practice or wise to create an object in the server scope? And if so how long does it live? I see in the administrator Memory Variables you can set the application and Session time to live, but not server scope. What I want to do. cfif (not structKeyExists(server, MyPalAuth)) or isdefined(url.Flush) cflock name=Lock_MyPalAuth timeout=5 type=EXCLUSIVE cfobject name=Server.MyPalAuth component=mycoms.MyPalAuth /cflock /cfif I read this from Ben's new Advanced Macromedia ColdFusion MX 7 Application Development book. But he used Application scope. I want the object to be created once on our intranet and then invoke it when needed in more then one application. I could place it in the application scope, but then that would mean for each application I would have to recreate the object. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206302 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Server Scope
-Original Message- From: David Brown [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 10, 2005 11:41 PM To: CF-Talk Subject: Server Scope A few questions: Is it good practice or wise to create an object in the server scope? And if so how long does it live? I see in the administrator Memory Variables you can set the application and Session time to live, but not server scope. Generally it's only wise to use the server scope on servers (or instances) you control completely - never trust it on shared servers. This doesn't just mean hosting but also internal shared servers (consolidated corporate application servers for example). It's just not worth it. What I want to do. cfif (not structKeyExists(server, MyPalAuth)) or isdefined(url.Flush) cflock name=Lock_MyPalAuth timeout=5 type=EXCLUSIVE cfobject name=Server.MyPalAuth component=mycoms.MyPalAuth /cflock /cfif Depending on the need for this you may not need the lock - or you may need a better check. Your first CFIF checks to see if something exists: but multiple requests may hit that at the same time. This means that multiple templates will be sitting on that lock - waiting for it to free up. So if you start your server under load your cfobject call may occur multiple times. To prevent this you'll need to do your check twice (but only do the URL check the first time): cfif (not structKeyExists(server, MyPalAuth)) or isdefined(url.Flush) cflock name=Lock_MyPalAuth timeout=5 type=EXCLUSIVE cfif (not structKeyExists(server, MyPalAuth)) cfobject name=Server.MyPalAuth component=mycoms.MyPalAuth /cfif /cflock /cfif I read this from Ben's new Advanced Macromedia ColdFusion MX 7 Application Development book. But he used Application scope. I want the object to be created once on our intranet and then invoke it when needed in more then one application. I could place it in the application scope, but then that would mean for each application I would have to recreate the object. It sound like a perfect use for the Server Scope. Jim Davis ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206306 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Server Scope
Jim, Thank you sir for the answer. Do you know how long the time to live is? Where do you set the time? - Original Message - From: Jim Davis [EMAIL PROTECTED] To: CF-Talk cf-talk@houseoffusion.com Sent: Wednesday, May 11, 2005 12:01 AM Subject: RE: Server Scope -Original Message- From: David Brown [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 10, 2005 11:41 PM To: CF-Talk Subject: Server Scope A few questions: Is it good practice or wise to create an object in the server scope? And if so how long does it live? I see in the administrator Memory Variables you can set the application and Session time to live, but not server scope. Generally it's only wise to use the server scope on servers (or instances) you control completely - never trust it on shared servers. This doesn't just mean hosting but also internal shared servers (consolidated corporate application servers for example). It's just not worth it. What I want to do. cfif (not structKeyExists(server, MyPalAuth)) or isdefined(url.Flush) cflock name=Lock_MyPalAuth timeout=5 type=EXCLUSIVE cfobject name=Server.MyPalAuth component=mycoms.MyPalAuth /cflock /cfif Depending on the need for this you may not need the lock - or you may need a better check. Your first CFIF checks to see if something exists: but multiple requests may hit that at the same time. This means that multiple templates will be sitting on that lock - waiting for it to free up. So if you start your server under load your cfobject call may occur multiple times. To prevent this you'll need to do your check twice (but only do the URL check the first time): cfif (not structKeyExists(server, MyPalAuth)) or isdefined(url.Flush) cflock name=Lock_MyPalAuth timeout=5 type=EXCLUSIVE cfif (not structKeyExists(server, MyPalAuth)) cfobject name=Server.MyPalAuth component=mycoms.MyPalAuth /cfif /cflock /cfif I read this from Ben's new Advanced Macromedia ColdFusion MX 7 Application Development book. But he used Application scope. I want the object to be created once on our intranet and then invoke it when needed in more then one application. I could place it in the application scope, but then that would mean for each application I would have to recreate the object. It sound like a perfect use for the Server Scope. Jim Davis ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206307 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Server Scope
-Original Message- From: David Brown [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 11, 2005 12:10 AM To: CF-Talk Subject: Re: Server Scope Jim, Thank you sir for the answer. Do you know how long the time to live is? Where do you set the time? Oops - missed that one. Anything put in the server scope will live as long as the server is up and running - barring recycling it's effectively permanent. Of course it can be deleted manually by any template on the server (a StructClear(Server) would do it) - but the ColdFusion engine won't ever time out the material. That being said you still need code like you have to do the initialization the first time, but once that's done you don't have to worry about it. Jim Davis ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206308 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Append variables to the server scope?
Is there a way to append variables to the server scope of a cf server? for isntance, you're running clustered servers and want to be able to distinguish which server you're on by server.serverName and it return the name of the server you're on.cfregistry is disabled so you can't pull it from the database.However, access to the server is available if there is an xml file or somewhere that all of the rest of the server scope is stored.Any ideas? John [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Append variables to the server scope?
Could it be this simple? cfset server.serverName = freddy I'm not sure but I believe you think it's difficult to write to the server scope, correct? Or am just not understanding what your looking for? I guess you throw me of by saying append don't you just mean set in the server scope? The server scope is stored in memory btw, once the server is rebooted the variables are lost. Taco Fleur Bloghttp://www.tacofleur.com/index/blog/ http://www.tacofleur.com/index/blog/ Methodology http://www.tacofleur.com/index/methodology/ 0421 851 786 Tell me and I will forget Show me and I will remember Teach me and I will learn -Original Message- From: Burns, John [mailto:[EMAIL PROTECTED] Sent: Friday, 23 January 2004 5:57 AM To: CF-Talk Subject: Append variables to the server scope? Is there a way to append variables to the server scope of a cf server? for isntance, you're running clustered servers and want to be able to distinguish which server you're on by server.serverName and it return the name of the server you're on.cfregistry is disabled so you can't pull it from the database.However, access to the server is available if there is an xml file or somewhere that all of the rest of the server scope is stored.Any ideas? John _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Append variables to the server scope?
Well, I was thinking more along the lines of it permanently being written on that server.Like the CF Serial # is and all the other stuff that's in the server scope.I don't want to have to make a call to a script that sets that every time.I mean set it once and then it stays. How does MM set all of the server scopes that are always there? John -Original Message- From: Taco Fleur [mailto:[EMAIL PROTECTED] Sent: Thursday, January 22, 2004 3:21 PM To: CF-Talk Subject: RE: Append variables to the server scope? Could it be this simple? cfset server.serverName = freddy I'm not sure but I believe you think it's difficult to write to the server scope, correct? Or am just not understanding what your looking for? I guess you throw me of by saying append don't you just mean set in the server scope? The server scope is stored in memory btw, once the server is rebooted the variables are lost. Taco Fleur Bloghttp://www.tacofleur.com/index/blog/ http://www.tacofleur.com/index/blog/ Methodology http://www.tacofleur.com/index/methodology/ 0421 851 786 Tell me and I will forget Show me and I will remember Teach me and I will learn -Original Message- From: Burns, John [mailto:[EMAIL PROTECTED] Sent: Friday, 23 January 2004 5:57 AM To: CF-Talk Subject: Append variables to the server scope? Is there a way to append variables to the server scope of a cf server? for isntance, you're running clustered servers and want to be able to distinguish which server you're on by server.serverName and it return the name of the server you're on.cfregistry is disabled so you can't pull it from the database.However, access to the server is available if there is an xml file or somewhere that all of the rest of the server scope is stored.Any ideas? John _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Append variables to the server scope?
I don;t know how they do that, but I just check if its set, i.e. cfif NOT structKeyExists(server, info) then set it all... Taco Fleur Bloghttp://www.tacofleur.com/index/blog/ http://www.tacofleur.com/index/blog/ Methodology http://www.tacofleur.com/index/methodology/ 0421 851 786 Tell me and I will forget Show me and I will remember Teach me and I will learn -Original Message- From: Burns, John [mailto:[EMAIL PROTECTED] Sent: Friday, 23 January 2004 6:29 AM To: CF-Talk Subject: RE: Append variables to the server scope? Well, I was thinking more along the lines of it permanently being written on that server.Like the CF Serial # is and all the other stuff that's in the server scope.I don't want to have to make a call to a script that sets that every time.I mean set it once and then it stays. How does MM set all of the server scopes that are always there? John -Original Message- From: Taco Fleur [mailto:[EMAIL PROTECTED] Sent: Thursday, January 22, 2004 3:21 PM To: CF-Talk Subject: RE: Append variables to the server scope? Could it be this simple? cfset server.serverName = freddy I'm not sure but I believe you think it's difficult to write to the server scope, correct? Or am just not understanding what your looking for? I guess you throw me of by saying append don't you just mean set in the server scope? The server scope is stored in memory btw, once the server is rebooted the variables are lost. Taco Fleur Bloghttp://www.tacofleur.com/index/blog/ http://www.tacofleur.com/index/blog/ Methodology http://www.tacofleur.com/index/methodology/ 0421 851 786 Tell me and I will forget Show me and I will remember Teach me and I will learn -Original Message- From: Burns, John [mailto:[EMAIL PROTECTED] Sent: Friday, 23 January 2004 5:57 AM To: CF-Talk Subject: Append variables to the server scope? Is there a way to append variables to the server scope of a cf server? for isntance, you're running clustered servers and want to be able to distinguish which server you're on by server.serverName and it return the name of the server you're on.cfregistry is disabled so you can't pull it from the database.However, access to the server is available if there is an xml file or somewhere that all of the rest of the server scope is stored.Any ideas? John _ _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Append variables to the server scope?
Is there a way to append variables to the server scope of a cf server? I'm not sure I understand. Do you mean something other than simply setting variables within code? cfset Server.foo = bar If you want these variables to be created whenever the server is restarted, I think you'll have to put them in one or more Application.cfm files to ensure their creation. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Server Scope / UDFs
Is there a way to force CFMX to load some vars into server scope when the service is started? Also, has anyone had any negative reaction to loading a CFC into server scope? I basically have a library of UDFs I want globally available that I thought I would throw into a CFC and load into server scope. This way the UDF's would be available to all code, including typically blackboxed code like other CFCs and Custom tags, etc. Lastly, if someone has figured out a way to load UDFs in such a way that they behave like native functions, I would love to hear about it. (ie, globally available on the MX box without having to scope them). I would prefer to do #formatphone()# rather than #server.udfs.formatphone()#. Thanks, Sean ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm
RE: Server Scope / UDFs
Is there a way to force CFMX to load some vars into server scope when the service is started? No. Unless you have all your code under an Application.cfm that does it. FYI, 'events' like this has been on the enhancement list for sometime. :) Also, has anyone had any negative reaction to loading a CFC into server scope? I basically have a library of UDFs I want globally available that I thought I would throw into a CFC and load into server scope. This way the UDF's would be available to all code, including typically blackboxed code like other CFCs and Custom tags, etc. Well, it is not recommends for CF5 because you would need to lock every use of it. However in MX you wouldn't need to worry about it. === Raymond Camden, ColdFusion Jedi Master for Hire Email: [EMAIL PROTECTED] WWW : www.camdenfamily.com/morpheus Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
Re: Server Scope / UDFs
On Tuesday, Nov 19, 2002, at 08:35 US/Pacific, Sean Daniels wrote: Is there a way to force CFMX to load some vars into server scope when the service is started? As Raymond says, put code in Application.cfm to load it once. Also, has anyone had any negative reaction to loading a CFC into server scope? Note that you cannot output HTML from methods of CFCs that are stored in shared scopes (but, hey, you wouldn't be outputting HTML from CFCs anyway, would you?). Lastly, if someone has figured out a way to load UDFs in such a way that they behave like native functions, I would love to hear about it. Nope, you need to scope them. Sure, you could create a 'local' alias via Application.cfm (cfset formatphone = server.udfs.formatphone/) but that won't be available inside custom tags for example. Sean A Corfield -- Director, Architecture Web Technology Group -- Macromedia, Inc. tel: (415) 252-2287 -- cell: (415) 717-8473 aim: seancorfield -- http://www.macromedia.com An Architect's View -- http://www.corfield.org/blog/ Introducing Macromedia Contribute. Web publishing for everyone. Learn more at http://www.macromedia.com/contribute ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm
Re: Server Scope / UDFs
On Tuesday, November 19, 2002, at 11:51 AM, Raymond Camden wrote: No. Unless you have all your code under an Application.cfm that does it. FYI, 'events' like this has been on the enhancement list for sometime. :) Thanks for the responses Sean Ray. I hope the events thing happens someday. As easy as it would be to add cfif not isdefined(server.udfs) to every application.cfm on the server it would be far cooler to not have to. :) Well, it is not recommends for CF5 because you would need to lock every use of it. However in MX you wouldn't need to worry about it. Yeah, this is MX, so not as much of an issue. On Tuesday, November 19, 2002, at 01:58 PM, Sean A Corfield wrote: Note that you cannot output HTML from methods of CFCs that are stored in shared scopes (but, hey, you wouldn't be outputting HTML from CFCs anyway, would you?). Absolutely not! :) Nope, you need to scope them. Sure, you could create a 'local' alias via Application.cfm (cfset formatphone = server.udfs.formatphone/) but that won't be available inside custom tags for example. Right. I was more looking for a hack ala putting custom tags into the cf-root\wwwroot\WEB-INF\cftags directory so they be called like native tags. Oh well. Only a little additional typing. ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting.
RE: Server Scope / UDFs
As easy as it would be to add cfif not isdefined(server.udfs) to every application.cfm on the server it would be far cooler to not have to. :) Well, personally, I'm not much of a fan of the idea of loading UDFs into memory anyway - memory is good for storing data, but is wasted on code. However, if you really want to do this, there's no reason why you can't write a batch file to start CF, then request a CF file using an HTTP command-line client, like wget, to initialize your data. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
Re: Server Scope / UDFs
On Tuesday, Nov 19, 2002, at 12:05 US/Pacific, Dave Watts wrote: Well, personally, I'm not much of a fan of the idea of loading UDFs into memory anyway - memory is good for storing data, but is wasted on code. Well, functions are just data. The benefit is that you don't have to include the file that defines the function... Sean A Corfield -- Director, Architecture Web Technology Group -- Macromedia, Inc. tel: (415) 252-2287 -- cell: (415) 717-8473 aim: seancorfield -- http://www.macromedia.com An Architect's View -- http://www.corfield.org/blog/ Introducing Macromedia Contribute. Web publishing for everyone. Learn more at http://www.macromedia.com/contribute ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm
Re: Server Scope / UDFs
On Tuesday, Nov 19, 2002, at 12:05 US/Pacific, Dave Watts wrote: Well, personally, I'm not much of a fan of the idea of loading UDFs into memory anyway - memory is good for storing data, but is wasted on code. Well, functions are just data. The benefit is that you don't have to include the file that defines the function... I have a sneaky suspicion that cfset myudf = application.udf.myudf is faster than cffunction name=myudf ... /cffunction or the cfscript equivalent... I've never load tested it, but i would expect that the CF processing engine, whether it's CF 5 pcode or CF MX Java has to take more time to read in and create the function than to assign a pointer to it. The pointer is after all only a byte or two of volatile memory lookup vs. the function definition which is invariably larger, plus time to actually parse and validate the code and make sure it's not missing a double-quote or a close-parenthesis somewhere, etc. Does anybody know for sure? Has anyone done any load testing to compare them? s. isaac dealey954-776-0046 new epoch http://www.turnkey.to lead architect, tapestry cms http://products.turnkey.to certified advanced coldfusion 5 developer http://www.macromedia.com/v1/handlers/index.cfm?ID=21816 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com