ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 23rd, 2005, 07:41 AM
Bastion Bastion is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 181 Bastion User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 4 h 25 m 11 sec
Reputation Power: 5
Session Variable vs. Application variable

I'm looking for opinions. Which is better for load time, organization, server drain, etc. session variables or application variables?

Reply With Quote
  #2  
Old February 23rd, 2005, 08:19 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,681 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 22 m 41 sec
Reputation Power: 53
Both are stored in memory so both are very fast. That said, I think you may want to do some additional reading, because session variables and application variables are meant to solve two totally different types of problems.

A session variable is specific to a single user, based on a cookie or an identifier passed in the URL. This would be something like a shopping cart or user login information.

An application variable is shared across all users of a single application (based on the name used in the cfapplication tag). So this would be useless for a shopping cart. But might be appropriate for caching the site menu, or creating a Singleton instance of a CFC.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old February 23rd, 2005, 06:27 PM
Alas's Avatar
Alas Alas is offline
Wickedwd.com
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: wickedwd.com
Posts: 187 Alas Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 17 h 32 m 22 sec
Reputation Power: 0
Dont forget about Cookies, sometimes sessions dont retain, i use this alot

<CFIF isdefined("Session.Whatever")>
<CFSET COOKIE.Whatever>
</CFIF>


This is when Kiteless says "be careful with cookies not all users can utilize them"

Ps he would be right

Reply With Quote
  #4  
Old February 23rd, 2005, 06:57 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,681 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 22 m 41 sec
Reputation Power: 53
Not only that but there are severe limits on the size of a cookie, as well as the number of cookies the browser will allow you to set per domain. Finally, trying to store large data sets or CFC instances are impossible with a cookie. Cookies are meant for storing extremely basic things like a session identifier, date of last visit, etc.

Reply With Quote
  #5  
Old February 23rd, 2005, 11:59 PM
hoolahawk hoolahawk is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: Australia
Posts: 57 hoolahawk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 29 m 43 sec
Reputation Power: 5
Another example between a applicaton and session variable is we use a application variable to set our company name so that we can display it on various relavant pages on our site

As our name does not change very often, this is a great way to use it for us because we can use the variable but do not have to create a include for this small piece of data.

Where for a registration form that we have on our site we create a session so that we can store different piece of data while the are progressing through the step by step form.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Session Variable vs. Application variable


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT