bpurcell.org - Using CF_Accelerate on secure sites
Calendar
SunMonTueWedThuFriSat
  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      

Subject Archives
Amazon EC2 (15)
ColdFusionMX (155)
Corvette (3)
Flash Lite (4)
Flash Media Server (5)
Flash Player (3)
Flex (39)
General Web Dev (14)
HDTV (3)
Jboss (1)
Jquery (2)
JRun (59)
Max 2003 (3)
Other (33)
PC Hardware (16)
Software (17)
SpatialKey (7)
Wireless (8)
Working Out (1)

RSS Feed
Feed Listing

Site Contents
Home
My Blog
ColdFusion
JRun
Flex
Wireless & Networking
Hardware & Gadgets
HDTV
Software Picks
Pictures
Contact Me
Search


My Articles & Papers
Flex Performance
Server/Client
mm.com Under the Hood
Multiple Instances of CFMX
Multiple Instance Config
NLB with ColdFusion
Clustering CFMX for J2EE
Multi-Tier Hardware LB w CFMX
Cisco CSS & Coldfusion MX
JRun 4 Jini based Clustering
WiFi Growth

2ID Tacweb

Other Hobbys
Body-For-Life Challenge

Personal Projects
Family Pool
Deck Gate

username:
password:
 

 
Viewing Individual Entry / Main
January 30, 2004

I received the following question on the functionality of CF_Accelerate and wanted to share how I worked around it.

"Got a questions regarding the CF_Accelerate customtag you have created. The caching is set according to the querystring and filename right? Well when you have an application that requires users to login, a session will be set whether or not the user is logged in. Now here comes the problem. It doesn't matter whether you are logged in or not, the same pages and its querystrings will be used. So when you log in and the page is cached when you're logged out, the logged in user will still see the page as if the user was logged out. Because the check is being done by sessions.  Do you recognize this problem and do you have a solution to this, or areyou working on something to overcome this? "

This question caused me problems on my own site.  But there is an easy work around. CF_Accelerate without any arguments will exhibit this behavior. The cached is built in a tree based on three attributes:

application.accelerator[scriptName][primarykey][secondaryKey].*

  1. attributes.scriptName - first key defaults to the cgi.script_name
  2. attributes.primaryKey - second key defaults to the query string
  3. attributes.secondaryKey - third key defaults to the string "default"

The third key is not really used but it is there if you need it.  In your case you could use use a session variable as the secondaryKey to determine if the user is logged in and it will cache different data if they are logged in.  For example

<cf_accelerate secondaryKey="#session.loggedin#">

session.loggedin could be true/false or whatever you want.

On my site when I am logged in I don't cache the data. So I used something like

<cf_accelerate noCache="#session.IsLoggedIn#">

If a user is logged in the data is not cached at all. If a user comes to the site session.IsLoggedIn is false and the data comes from the cache. There may be a better solution, feel free to share your thoughts.

 

Comments

This is indeed a very easy solution. When you define usergroups, which have access to a specific piece of content, you can even use #session.loggedOn##userGroups#

userGroups variable can be passed like a List then.


 
Page Render Time:219