Closed jamemackson closed 7 years ago
Is it? It shouldn't be a string! Who's serializing?!
(Will check tomorrow ;-) )
yup, I believe when it gets backed into the request it's being serialized as a string and then staying that way when it's pulled back out in addToRedis
. as it is, you can set enabled to false
all you want but the cache will keep on caching ;)
Unfortunately I can't seem to reproduce this. typeof enabled
shows boolean in both middlewares for me.
Just double checking: you are actually passing a boolean?
yes I double checked this. I'm using node 7.6, maybe that makes a difference? Odd you aren't seeing the same behavior though. 🤔
I've tested on 7.9.0 lastly, don't think that should make a difference (as 7.6 was the major change). I wouldn't know what'd serialize it on the way. Are you by any chance doing that yourself?
nope. it's fine. we can close this out. I'll re-open if this presents itself again.
This flag is coming into
addToRedis
as a string and not a boolean so the check ofif(request[requestKey].enabled){
is not resulting properly when disabled resulting in the caching always being active.https://github.com/nickschot/lux-redis-cache/blob/ad35f41af74884cdc5d69c7d855127dc59f55566/lib/index.js#L114