@jeffjade
2018-04-21T13:45:07.000000Z
字数 1195
阅读 1116
Shell
for n in 1 2 3 4 5 6 7 8 9 10curl -s "http://localhost:4000/api/getAllLinksCount?active=true" -o /dev/null -w "\n%{time_total}"for n in 1 2 3 4 5 6 7 8 9 10curl -s "https://nicelinks.site/api/getAllLinksCount?active=true" -o /dev/null -w "\n%{time_total}"for n in 1 2 3 4 5 6 7 8 9 10curl -s "https://nicelinks.site/" -o /dev/null -w "\n%{time_total}"
app.use(async(ctx, next) => {console.log('ctx.request.url', ctx.request.url)const request = ctx.requestconst isRequestPage = request.url.indexOf('/api/') === -1const isForceUpdate = request.url.indexOf('cache=update') === -1if (isRequestPage) {const pageCacheKey = 'nicelinks-index'const pageInCache = await PageCache.get(pageCacheKey)console.log('pageInCache', pageInCache)if (pageInCache && !isForceUpdate) {return pageInCache} else {let filePath = __dirname + '/../../public/index.html'let content = fs.readFileSync(filePath, 'utf8')PageCache.set(pageCacheKey, content)ctx.body = contentreturn}}await require('./../routes').routes()(ctx, next)})
deleteNodeByName (source, name) {// JSON.parse(JSON.stringify(list))✅; but slice() ❌;let tempList = this.$_.cloneDeep(source)tempList.forEach(item => {item[name] && delete item[name]if (item.children && item.children.length) {for (let key in item.children) {delete item.children[key][name]}}})return tempList},
