我需要将键从字符串类型转换为哈希类型。所有键的名称都在集合list:of:keys中。
我目前的实现如下:
var rdbc = require("redis").createClient(6379, '127.0.0.1');
rdbc.smembers("list:of:keys", function(err, strings){
strings.forEach(function(string, index, strings){
rdbc.get(string, function(err, result){
rdbc.del(string);
rdbc.hset(string, "foo", result);
});
});
});我的尝试成功了。但是,当list:of:keys包含许多值时,内存的使用率就会增加很多。
strings.forEach(…,我是否通知node.js中的垃圾收集器在每次rdbc.del/rbdc.hset操作后进行清理?发布于 2012-06-15 16:52:50
- [https://developers.google.com/v8/design#garb\_coll](https://developers.google.com/v8/design#garb_coll)
- [Node.js and V8 garbage collection](https://stackoverflow.com/questions/5603011/node-js-and-v8-garbage-collection)
- [garbage collection with node.js](https://stackoverflow.com/questions/5326300/garbage-collection-with-node-js?rq=1)
- [Node.js' garbage collector](https://stackoverflow.com/questions/5331480/node-js-garbage-collector?rq=1)
https://stackoverflow.com/questions/11054810
复制相似问题