Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proxy/topic加一句代码首页就可以缓存了 #523

Closed
luoyjx opened this issue May 6, 2015 · 6 comments
Closed

proxy/topic加一句代码首页就可以缓存了 #523

luoyjx opened this issue May 6, 2015 · 6 comments

Comments

@luoyjx
Copy link

luoyjx commented May 6, 2015

100行加一行

if (topic) {
  topic.author = author;
  topic.reply = last_reply;
  topic.friendly_create_at = tools.formatDate(topic.create_at, true);
}

变成

if (topic) {
  topic = topic.toObject();
  topic.author = author;
  topic.reply = last_reply;
  topic.friendly_create_at = tools.formatDate(topic.create_at, true);
}

然后再到controller/site里加缓存,你看需不需要
@alsotang

@alsotang
Copy link
Member

alsotang commented May 7, 2015

暂时还是不要了。现在这方面的性能问题也不大。

按照这篇文章来说,对于这类场景我还是倾向于 html 片段缓存:https://cnodejs.org/topic/55210d88c4f5240812f55408

@luoyjx
Copy link
Author

luoyjx commented May 7, 2015

我看了半天...结果发现我说的好像就是缓存首页的文章列表片段啊~
就是我问的mongoose丢弃schema之外属性的问题

@alsotang
Copy link
Member

alsotang commented May 7, 2015

html 片段缓存中的【片段】是指渲染出来之后的 html。

@luoyjx
Copy link
Author

luoyjx commented May 7, 2015

指的是,通过将几个部分分离到几个html模板中缓存这几个html渲染后的结果么

@luoyjx luoyjx closed this as completed May 7, 2015
@alsotang
Copy link
Member

alsotang commented May 7, 2015

你就不能 google 一下什么是【html片段缓存】吗

@luoyjx
Copy link
Author

luoyjx commented May 7, 2015

只是确认下是不是ejs 缓存的片段....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants