Comparing version 0.3.0 to 0.4.0
@@ -119,5 +119,3 @@ const crypto = require('crypto'); | ||
(n ? Math.floor(this._now() - n) : '-inf'), '+inf') | ||
.then(resp => { | ||
return Number(resp); | ||
}); | ||
.then(resp => Number(resp)); | ||
}); | ||
@@ -127,2 +125,21 @@ } | ||
/** | ||
* Retrieves session count of single user which were active within the last n seconds. | ||
* | ||
* @param {string} userId | ||
* @param {number} [n=10] | ||
* @return {Promise<Array<String>>} | ||
*/ | ||
countForUser(userId, n) { | ||
if (!userId) | ||
return Promise.reject(new ArgumentError('You must provide userId')); | ||
return this._getClient().then(client => { | ||
n = Number(n); | ||
const prefix = this._ns + ':' + this._appName; | ||
return client.zcount(prefix + ':user_' + userId, | ||
(n ? Math.floor(this._now() - n) : '-inf'), '+inf') | ||
.then(resp => Number(resp)); | ||
}); | ||
} | ||
/** | ||
* Creates new session | ||
@@ -129,0 +146,0 @@ * |
{ | ||
"name": "redisess", | ||
"description": "Powerful redis session manager for NodeJS", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"author": "Panates Ltd.", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21859
619