Tag: 清除

以编程方式清除cloudflarecaching

我试图清除cloudflarecaching单个url后,将请求放入node.js api。 我正在使用https://github.com/cloudflare/node-cloudflare库,但是我不知道如何logging从cloudflare的callback。 根据同一个仓库中的testing文件,语法应该是这样的: //client declaration: t.context.cf = new CF({ key: 'deadbeef', email: 'cloudflare@example.com', h2: false }); //invoke clearCache: t.context.cf.deleteCache('1', { files: [ 'https://example.com/purge_url' ] }) 我怎样才能读出这个请求的callback? 我已经在我自己的代码中尝试了以下内容: client.deleteCache(process.env.CLOUDFLARE_ZONE, { "files": [url] }, function (data) { console.log(`Cloudflare cache purged for: ${url}`); console.log(`Callback:${data}`); }) 和: client.deleteCache('1', { files: [ 'https://example.com/purge_url' ] }).then(function(a,b){ console.log('helllllllooooooooo'); }) 无济于事。 🙁

清除Node.js全局variables属性

我的问题不是关于“内存泄漏”,而是关于node.js(expressjs)应用程序的“内存清除”。 我的应用程序应该在服务期间为内存中的快速查找维护一些对象。 在启动应用程序之后(一两天),everthing似乎很好,直到突然我的Web客户端查找对象,因为它已被清除(未定义)。 我怀疑JavaScript GC(垃圾收集)。 但是,正如您在psedu-code中看到的那样,我将对象分配给node.js“global”variables属性,以防止GC清除它们。 请给我一些线索是什么导致了这个问题。 非常感谢您提供的build议〜 我的node.js环境是node.js 0.6.12,expressjs 2.5.8和VMWare cloudfoundry节点托pipe。 这是我的app.js伪代码: var express = require("express"); var app = module.exports = express.createServer(); // myMethods holds a set of methods to be used for handling raw data. var myMethods = require("myMethods"); // creates node.js global properties referencing objects to prevent GC from purging them global.myMethods […]