Created
August 7, 2014 23:13
-
-
Save stevewithington/c171d9d93d58440af9d1 to your computer and use it in GitHub Desktop.
Mura CMS : Session Variable Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
public any function onSiteRequestStart($) { | |
param name='session.customsession' default=getDefaultCustomSessionSettings(); | |
// you could use whatever trigger you want to set your session var(s), but i'm just using something simple for this example | |
if ( IsDefined('url.somekey') ) { | |
lock scope='session' type='exclusive' timeout=10 { | |
session.customsession = { | |
somekey = url.somekey | |
, dateinitalized = Now() | |
, inited = true | |
} | |
} | |
} | |
} | |
public void function onGlobalSessionStart($) { | |
WriteLog(text='custom session started', type='information', application=true, file='customsession'); | |
} | |
public void function onGlobalSessionEnd($) { | |
WriteLog(text='custom session expired', type='information', application=true, file='customsession'); | |
} | |
public void function onSiteSessionEnd($) { | |
onGlobalSessionEnd(argumentCollection=arguments); | |
} | |
private any function getDefaultCustomSessionSettings() { | |
return { | |
somekey = '' | |
, dateinitalized = '' | |
, inited = false | |
}; | |
} | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment