question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Promise support (Purposal)

See original GitHub issue

Would be great to support Promises and also keep callback support.

I purpose something where memcached.gets('foo', function); would still work as today and memcached.gets('foo'); would return a Promise object that rejects on error and resolves on success. What do you think ? I can make a PR if there are interest.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:33
  • Comments:7

github_iconTop GitHub Comments

9reactions
k0ff33commented, Oct 13, 2017

That would be really great! I have an async/await flow in my server and at the moment I have to use Node 8 util.promisify functionality to enable promises.

const { promisify } = require('util')
const Memcached = require('memcached')

const memcached = new Memcached(process.env.MEMCACHED_URL)

const memcachedGet = promisify(memcached.get).bind(memcached)
const memcachedSet = promisify(memcached.set).bind(memcached)

module.exports = {
  get: memcachedGet,
  set: memcachedSet
}
5reactions
elegisandicommented, Feb 14, 2019

@mapleeit would you mind creating new release with the promise-based support? thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Promise - JavaScript - MDN Web Docs
Creates a new Promise object. The constructor is primarily used to wrap functions that do not already support promises. Static methods. Promise.
Read more >
Support for Distributed Promise Pipelining details
This proposal adds eventual-send operations to JavaScript Promises, to express invocation of operations on potentially remote objects. We introduce the notion ...
Read more >
Delivering on a Promise | PMI
The way your organization handles proposals has a big impact on the projects ... Delivering on a Promise: Bridge the Gap Between Proposal...
Read more >
RFP: A Promise to BMORE
The resources that will be allocated will support organizations and environments that are comfortable, welcoming, caring, and non-judgmental of older youth.
Read more >
Promises/A - CommonJS Spec Wiki
Proposal. A promise represents the eventual value returned from the single completion of an operation. A promise may be in one of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found