Skip to content

Instantly share code, notes, and snippets.

@Unitech
Created October 8, 2014 15:01
Show Gist options
  • Save Unitech/c2161e2e9c1275189b22 to your computer and use it in GitHub Desktop.
Save Unitech/c2161e2e9c1275189b22 to your computer and use it in GitHub Desktop.
auto-patch.js
var Proxy = require('./utils/proxy.js');
var RedisWrap = require('./wrapper/redis.js');
var Transaction = module.exports = {};
Transaction.patch = function() {
var Module = require('module');
Proxy.wrap(Module, '_load', function(load) {
return function(file) {
if (file == 'redis') {
return RedisWrap(load.apply(this, arguments));
}
else
return load.apply(this, arguments);
};
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment