New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

redisess

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redisess - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

61

lib/SessionManager.js

@@ -92,5 +92,4 @@ const crypto = require('crypto');

* @param {Object} client
* @param {string} appName
* @param {Object} [options]
* @param {Object} [options.namespace='ssm']
* @param {Object} [options.namespace='sm']
* @param {number} [options.ttl] Time-To-Live value in seconds

@@ -100,11 +99,8 @@ * @param {number} [options.wipeInterval=1000]

*/
constructor(client, appName, options) {
constructor(client, options) {
if (!(client && typeof client.hmget === 'function'))
throw new ArgumentError('You must provide redis instance');
if (!appName)
throw new ArgumentError('You must provide application name');
options = options || {};
this._client = client;
this._appName = appName;
this._ns = (options.namespace || 'sm');
this._ns = (options.namespace || 'sessions');
this._ttl = Number(options.ttl) >= 0 ? Number(options.ttl) : (30 * 60);

@@ -132,3 +128,3 @@ this._timediff = null; // Difference between local time and redis server time in seconds

n = Number(n);
const prefix = this._ns + ':' + this._appName;
const prefix = this._ns;
return client.zcount(prefix + ':ACTIVITY',

@@ -152,4 +148,3 @@ (n ? Math.floor(this._now() - n) : '-inf'), '+inf')

n = Number(n);
const prefix = this._ns + ':' + this._appName;
return client.zcount(prefix + ':user_' + userId,
return client.zcount(this._ns + ':user_' + userId,
(n ? Math.floor(this._now() - n) : '-inf'), '+inf')

@@ -214,4 +209,3 @@ .then(resp => Number(resp));

n = Number(n);
const prefix = this._ns + ':' + this._appName;
return client.zrevrangebyscore(prefix + ':ACTIVITY',
return client.zrevrangebyscore(this._ns + ':ACTIVITY',
'+inf',

@@ -232,4 +226,3 @@ (n ? Math.floor(this._now() - n) : '-inf')

n = Number(n);
const prefix = this._ns + ':' + this._appName;
return client.zrevrangebyscore(prefix + ':USERS',
return client.zrevrangebyscore(this._ns + ':USERS',
'+inf',

@@ -253,4 +246,3 @@ (n ? Math.floor(this._now() - n) : '-inf')

n = Number(n);
const prefix = this._ns + ':' + this._appName;
return client.zrevrangebyscore(prefix + ':user_' + userId,
return client.zrevrangebyscore(this._ns + ':user_' + userId,
'+inf',

@@ -271,4 +263,3 @@ (n ? Math.floor(this._now() - n) : '-inf'));

return this._getClient().then(client => {
const prefix = this._ns + ':' + this._appName;
return client.exists(prefix + ':sess_' + sessionId)
return client.exists(this._ns + ':sess_' + sessionId)
.then(resp => !!Number(resp));

@@ -311,6 +302,5 @@ });

killAll() {
return this._getClient().then(client => {
const prefix = this._ns + ':' + this._appName;
return killAllScript.execute(client, prefix + ':*').then(() => true);
});
return this._getClient().then(client =>
killAllScript.execute(client, this._ns + ':*').then(() => true)
);
}

@@ -365,6 +355,5 @@

this._wipeTimer = null;
return this._getClient().then(client => {
const prefix = this._ns + ':' + this._appName;
return wipeScript.execute(client, prefix, this._now());
});
return this._getClient().then(client =>
wipeScript.execute(client, this._ns, this._now())
);
}

@@ -397,3 +386,3 @@

*
* @return {number}
* @return {SessionManager}
*/

@@ -407,3 +396,3 @@ get manager() {

*
* @return {number}
* @return {string}
*/

@@ -480,4 +469,3 @@ get sessionId() {

const manager = this._manager;
const sessKey = manager._ns + ':' + manager._appName +
':sess_' + this.sessionId;
const sessKey = manager._ns + ':sess_' + this.sessionId;
return manager._getClient().then(client => {

@@ -522,4 +510,3 @@ const args = ['us', 'la', 'ex', 'ttl'];

const manager = this._manager;
const sessKey = manager._ns + ':' + manager._appName +
':sess_' + this.sessionId;
const sessKey = manager._ns + ':sess_' + this.sessionId;
const fromTyped = (v) => {

@@ -588,5 +575,3 @@ let x = v.substring(1);

const manager = this._manager;
const sessKey = manager._ns + ':' + manager._appName +
':sess_' + this.sessionId;
const sessKey = manager._ns + ':sess_' + this.sessionId;
return manager._getClient().then(client => {

@@ -612,5 +597,4 @@ const values = this._prepareUserData(key, value);

return manager._getClient().then(client => {
const prefix = manager._ns + ':' + manager._appName;
const {sessionId, userId} = this;
return killScript.execute(client, prefix, sessionId, userId)
return killScript.execute(client, manager._ns, sessionId, userId)
.then(resp => {

@@ -638,4 +622,3 @@ /* istanbul ignore next */

const {sessionId, userId, lastAccess, expires, ttl} = this;
const prefix = manager._ns + ':' + manager._appName;
const args = [prefix, lastAccess, userId, sessionId, expires, ttl];
const args = [manager._ns, lastAccess, userId, sessionId, expires, ttl];
/* istanbul ignore else */

@@ -642,0 +625,0 @@ if (manager._additionalFields)

{
"name": "redisess",
"description": "Powerful redis session manager for NodeJS",
"version": "0.5.0",
"version": "0.6.0",
"author": "Panates Ltd.",

@@ -6,0 +6,0 @@ "contributors": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc