Skip to content

Commit

Permalink
added dissconnect method
Browse files Browse the repository at this point in the history
  • Loading branch information
nice-shot committed Jun 18, 2015
1 parent 5fb4428 commit da2b8e6
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions lib/restify-session.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* @class node_modules.restify_session
*
*
* @author Marcello Gesmundo
*
*
* This module manage session for a restify server without cookies. It uses Redis (>=2.0.0) as fast session store.
* Derived from redis-session.
*
*
* # Example
*
*
* var restify = require('restify'),
* session = require('restify-session')({
* debug : true,
Expand Down Expand Up @@ -44,19 +44,19 @@
* Session-Id ViS5pHE5n8McblTATbyFUJTGJyzVFeXOcAEZ41Zs
*
* For more information see test/test.js into package folder.
*
*
*
*
*
*
* # License
*
*
* Copyright (c) 2012 Mitchell Simoens (https://github.com/mitchellsimoens/redis-session)
*
* Copyright (c) 2012-2014 Yoovant by Marcello Gesmundo. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
Expand All @@ -66,7 +66,7 @@
* * Neither the name of Yoovant nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Expand Down Expand Up @@ -463,6 +463,16 @@ module.exports = function(config) {
});
};

/**
* Closes the connection to the redis server
*
* @param {Function} callback Callback to execute once connection is closed
*/
session.dissconnect = function (callback) {
session.client.quit();
session.client.on('end', callback);
};

/**
* Manage session in http requests
*
Expand Down

0 comments on commit da2b8e6

Please sign in to comment.