Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ Default: `1000*60*10` (10 minutes). How frequently the session store checks for

Default: `1000*60*60*24` (1 day). How long session data is stored for "user session" cookies -- i.e. sessions that only last as long as the user keeps their browser open, which are created by doing `req.session.maxAge = null`.

### logging ###

Default: `false`. If set to true, we are logging whats going on to stdout.

Changes
-------

Expand Down
18 changes: 9 additions & 9 deletions lib/connect-mysql-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = function (connect)
{
function MySQLStore(database, user, password, options)
{
options = options || {};
options = options || {logging: false};
connect.session.Store.call(this, options);

var self = this,
Expand All @@ -30,14 +30,14 @@ module.exports = function (connect)
sequelize.sync({force: forceSync})
.on('success', function ()
{
console.log('MySQL session store initialized.');
options.logging && console.log('MySQL session store initialized.');
initialized = true;
callback();
})
.on('failure', function (error)
{
console.log('Failed to initialize MySQL session store:');
console.log(error);
options.logging && console.log('Failed to initialize MySQL session store:');
options.logging && console.log(error);
callback(error);
});
}
Expand All @@ -54,7 +54,7 @@ module.exports = function (connect)
{
if (sessions.length > 0)
{
console.log('Destroying ' + sessions.length + ' expired sessions.');
options.logging && console.log('Destroying ' + sessions.length + ' expired sessions.');
for (var i in sessions)
{
sessions[i].destroy();
Expand All @@ -63,8 +63,8 @@ module.exports = function (connect)
})
.on('failure', function (error)
{
console.log('Failed to fetch expired sessions:');
console.log(error);
options.logging && console.log('Failed to fetch expired sessions:');
options.logging && console.log(error);
});
});
}, checkExpirationInterval);
Expand Down Expand Up @@ -141,8 +141,8 @@ module.exports = function (connect)
})
.on('failure', function (error)
{
console.log('Session ' + sid + ' could not be destroyed:');
console.log(error);
options.logging && console.log('Session ' + sid + ' could not be destroyed:');
options.logging && console.log(error);
fn && fn(error);
});
}
Expand Down