I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
Well it took me > 10 second to twig that "cb" meant "callBack" so there's that: use explicit variable names. Same with err - is it a message or a code or an object or what?
Other than that I have no idea what the braces around { promisify } are for because I don't do this language and am not sure what to google for to find out. I don't know any of these libraries so don't know what to expect.
Having said that, shots in the dark from an outside developer:
there's nothing that sets an expiry on the cached data - if I assume cache.has returns true even if the data's expired, and that you are expected to check some expiry time property, then it will never get updated.
fs.readFile might process a condition which is transiently invalid without throwing an exception, in which case it'll be stored for eternity.
cache.get(..) might return an object containing metadata alongside the actual payload, such as expiry time
I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
Well it took me > 10 second to twig that "cb" meant "callBack" so there's that: use explicit variable names. Same with
err
- is it a message or a code or an object or what?Other than that I have no idea what the braces around
{ promisify }
are for because I don't do this language and am not sure what to google for to find out. I don't know any of these libraries so don't know what to expect.Having said that, shots in the dark from an outside developer:
cache.has
returns true even if the data's expired, and that you are expected to check some expiry time property, then it will never get updated.fs.readFile
might process a condition which is transiently invalid without throwing an exception, in which case it'll be stored for eternity.cache.get(..)
might return an object containing metadata alongside the actual payload, such as expiry timeTo address your intrigue about the braces around promisify, this article may shed some light:
Object Destructuring in ES6
Sarah Chima
Oh that's cool. Just tried it in my node REPL and found whatever version of node you get with MacOS is too old (no surprises there though)