Skip to content

Commit 00ed909

Browse files
committed
Fix a bug with del on memcached
1 parent 246124a commit 00ed909

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ app.post('/auth',
143143

144144
Changelog
145145
---------
146+
### v0.4.2
147+
* BUG: In some cases when no callbacks were supplied memcached would drop the request. Ensure that memcached always sees a callback expressBrute isn't given one.
148+
146149
### v0.4.1
147150
* NEW: `refreshTimeoutOnRequest` option that allows you to prevent the remaining `lifetime` for a timer from being reset on each request (useful for implementing limits for set time frames, e.g. requests per day)
148151
* BUG: Lifetimes were not previously getting extended properly for instances of `ExpressBrute.MemoryStore`

lib/MemcachedStore.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ var MemcachedStore = module.exports = function (hosts, options) {
1313
MemcachedStore.prototype.__proto__ = AbstractClientStore.prototype;
1414
MemcachedStore.prototype.Memcached = Memcached;
1515
MemcachedStore.prototype.set = function (key, value, lifetime, callback) {
16-
this.client.set(this.options.prefix+key, JSON.stringify(value), lifetime || 0, callback);
16+
this.client.set(this.options.prefix+key, JSON.stringify(value), lifetime || 0, function (err, data) {
17+
typeof callback == 'function' && callback.apply(this, arguments);
18+
});
1719
};
1820
MemcachedStore.prototype.get = function (key, callback) {
1921
this.client.get(this.options.prefix+key, function (err, data) {
@@ -30,7 +32,9 @@ MemcachedStore.prototype.get = function (key, callback) {
3032
});
3133
};
3234
MemcachedStore.prototype.reset = function (key, callback) {
33-
this.client.del(this.options.prefix+key, callback);
35+
this.client.del(this.options.prefix+key, function (err, data) {
36+
typeof callback == 'function' && callback.apply(this, arguments);
37+
});
3438
};
3539
MemcachedStore.defaults = {
3640
prefix: ''

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "express-brute",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"description": "A brute-force protection middleware for express routes that rate limits incoming requests",
55
"keywords": [
66
"brute",

0 commit comments

Comments
 (0)