groupon / node-cached

A simple caching library for node.js, inspired by the Play cache API
BSD 3-Clause "New" or "Revised" License
94 stars 15 forks source link

Update documentation for `cached` and backends #27

Closed fdegiuli closed 8 years ago

fdegiuli commented 8 years ago

As per https://github.com/groupon/node-cached/issues/26

fdegiuli commented 8 years ago

You guys don't like console statements. Should I get rid of it, or just turn it into an error instead and you can bump the version number?

jkrems commented 8 years ago

You can use util.deprecate. The advantage of that function is that the warning will only be logged once, not on each access. This can be important in high traffic applications where the additional output could otherwise have performance implications. E.g.:

var getDefaultName = deprecate(function getDefaultName() {
  return 'default';
}, 'The actual warning');
// ...
if (badThing) { name = getDefaultName(); }
fdegiuli commented 8 years ago

Never knew about that thing, thanks!

Sorry for the delay, should be fixed now.

fdegiuli commented 8 years ago

So much git rebase 😢

jkrems commented 8 years ago

Yeah, it takes some getting used to. But the automation it enables is worth it. :) Thanks for this, much appreciated! Sorry for being a bit slow to respond, busy week.

:shipit: