开发者

Codeigniter caching question

I’m fairly new to Codeigniter. I have been reading the user guide extensively but one question has remained open for me.

Consider this scenario:

An article page, completely static with only one little dynamic text displaying the number of views this article has got.

How could I cache such a page in order开发者_高级运维 to serve it fast but still update the views counter?

Any answer will be greatly appreciated,

Tom


I'm pretty sure CI's caching out of the box is for full pages only, so your views count would not be updated.

You could either specify a large cache time e.g. $this->output->cache(180); which would cache for 2 hours, and then update the count, or look in to partial caching. Here's one such library.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜