Created
October 8, 2014 15:01
-
-
Save Unitech/c2161e2e9c1275189b22 to your computer and use it in GitHub Desktop.
auto-patch.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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