mm_redis 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +5 -2
- package/package.json +1 -1
- package/test_export.js +21 -0
package/index.js
CHANGED
|
@@ -2007,8 +2007,11 @@ Redis.prototype._getConnection = function() {
|
|
|
2007
2007
|
});
|
|
2008
2008
|
};
|
|
2009
2009
|
|
|
2010
|
-
// 导出Redis
|
|
2011
|
-
module.exports =
|
|
2010
|
+
// 导出Redis类和redis_admin函数
|
|
2011
|
+
module.exports = {
|
|
2012
|
+
Redis: Redis,
|
|
2013
|
+
redis_admin: redis_admin
|
|
2014
|
+
};
|
|
2012
2015
|
|
|
2013
2016
|
// 创建新连接的方法
|
|
2014
2017
|
Redis.prototype._createConnection = function() {
|
package/package.json
CHANGED
package/test_export.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// 测试redis_admin函数导出
|
|
2
|
+
const { Redis, redis_admin } = require('./index.js');
|
|
3
|
+
|
|
4
|
+
console.log('=== 测试redis_admin导出 ===');
|
|
5
|
+
console.log('Redis类是否存在:', typeof Redis === 'function');
|
|
6
|
+
console.log('redis_admin函数是否存在:', typeof redis_admin === 'function');
|
|
7
|
+
|
|
8
|
+
if (typeof redis_admin === 'function') {
|
|
9
|
+
console.log('✅ redis_admin函数导出成功!');
|
|
10
|
+
try {
|
|
11
|
+
// 尝试创建实例
|
|
12
|
+
const redis = redis_admin('test_scope');
|
|
13
|
+
console.log('成功通过redis_admin创建实例:', redis instanceof Redis);
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error('创建实例时出错:', error.message);
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
console.error('❌ redis_admin函数导出失败!');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
console.log('=== 测试完成 ===');
|