Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/promise-redis/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict';
var redis = require('redis'),
redisCmds = require('redis-commands').list;
function createCb(resolve, reject) {
return function (err, value) {
if (err !== null) {
reject(err);
} else {
resolve(value);
}
};
}
module.exports = function (promiseFactory) {
var mlproto = redis.Multi.prototype,
clproto = redis.RedisClient.prototype;
if (!promiseFactory) {
promiseFactory = function (resolver) {
return new Promise(resolver);
};
}
function promisify(f) {
return function () {
var args = Array.prototype.slice.call(arguments),
that = this;
if (typeof args[args.length - 1] === 'function') {
// Okay. Someone supplied a callback. Most likely some internal
// node-redis call (ready probe etc.). Oh, as a result of
// supporting internal callback-style calls, one can now use
// promise-redis as a dropin replacement for node-redis.
f.apply(this, args);
} else {
return promiseFactory(function (resolve, reject) {
args.push(createCb(resolve, reject));
f.apply(that, args);
});
}
};
}
redisCmds.forEach(function (fullCommand) {
var cmd = fullCommand.split(' ')[0];
if (cmd !== 'multi') {
clproto[cmd] = promisify(clproto[cmd]);
clproto[cmd.toUpperCase()] = clproto[cmd];
}
});
// For Multi only `exec` command returns promise.
mlproto.exec_transaction = promisify(mlproto.exec_transaction);
mlproto.exec = mlproto.exec_transaction;
mlproto.EXEC = mlproto.exec;
return redis;
};
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0047 ]-- |