Last active
April 28, 2017 08:30
-
-
Save roryl/44f730ecd8ba2593b03e45f1189fcf5f to your computer and use it in GitHub Desktop.
Lucee Database Session Storage
This file contains hidden or 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
USE lucee_sessions; | |
ALTER TABLE cf_session_data ADD PRIMARY KEY(cfid,name); |
This file contains hidden or 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
component { | |
this.datasources["lucee_sessions"] = { | |
class: 'org.gjt.mm.mysql.Driver' | |
, connectionString: 'jdbc:mysql://192.168.33.10:3306/lucee_sessions?useUnicode=true&characterEncoding=UTF-8&useLegacyDatetimeCode=true' | |
, username: 'lucee_sessions' | |
, password: "encrypted:8c3ea865feab8133a7614f58aee150cddee0ed6f82a476f1" | |
// optional settings | |
, storage:true // default: false | |
}; | |
this.sessionTimeout = createTimeSpan(0,0,20,0); //Set a default session timeout of 20 minutes | |
this.sessionStorage = "lucee_sessions"; //Set our session storage to the lucee_sessions datasource | |
this.sessionCluster = true; //Set true if more than one Lucee instance connected to the same sessison store | |
this.sessionType = "cfml"; //Needed for session clustering | |
function onSessionStart(){ | |
session.someData = "My Data"; | |
} | |
} |
This file contains hidden or 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
CREATE DATABASE lucee_sessions; | |
CREATE USER lucee_sessions@'localhost' identified by '123456'; | |
GRANT ALL ON lucee_sessions.* to lucee_sessions@'localhost' identified by '123456'; | |
FLUSH PRIVILEGES; |
This file contains hidden or 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
<cfdump var="#now()#"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment