Reputation: 47595
Would this work?
function onRequestStart(myPage) {
if (condition) {
this.sessionTimeout = CreateTimeSpan(0, 2, 0, 0)
} else {
this.sessionTimeout = CreateTimeSpan(0, 0, 1, 0)
}
}
If someone is logged in, I don't want to log them out, but if a spider comes along, I don't want the spider to tie up session storage for an extended period of time.
Maybe I'm worried about something I don't need to worry about.
Upvotes: 1
Views: 365
Reputation: 12486
I've done this before but not in onRequestStart()
. I put it in the pseudo-constructor area of Application.cfc (that is, before any of the method definitions). Apologies for the tag-based syntax:
<cfset variables.sessionTimeout = createTimeSpan(0,2,0,0) />
<cfif variables.isBot>
<cfset variables.sessionTimeout = createTimeSpan(0,0,1,0) />
</cfif>
<cfset this.SessionTimeout = variables.sessionTimeout />
And yes, it does work. I don't know if it would work if you put it inside onRequestStart()
. It saves a lot of memory especially if your site gets hit by a lot of bots.
Upvotes: 2