D
D
Daniel Mukhametshin2013-12-12 12:51:09
PHP
Daniel Mukhametshin, 2013-12-12 12:51:09

What is the best way to do caching?

In general, I need to cache (to be honest, I don’t know how to say it right) the header, but there are a couple of places in it where the number of articles is displayed, using php + mysql. Templates are stored in a separate file and I don’t know how to cache, now I will explain in more detail, but first an example, to interfere with your imagination :)

<html>
<div class = 'menu'>
<a href = '/news'>Новости</a>
<a href = '/article'>Статьи(на сайте <?php $data->articleNumber; ?> статей)</a>
</div>
</html>

That's the question itself: What is the best way to do caching? Maybe it's better to cache all this and forget about these problems, or do it somehow separately, for example, finish caching near the articles, and then continue? Or is there even some kind of html code, which prohibits caching this part?
PS Since I'm a caching nerd, can you give me some tips from the pros? :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Osher, 2013-12-12
@SpaceBike

Oh ... Read, for example, what features Yii provides.
www.yiiframework.com/doc/guide/1.1/ru/caching.overview
In your case, query caching in conjunction with dynamic content caching is suitable.
I hope you understand at least the ideology of how to mold all this.

S
Sergey, 2013-12-12
Protko @Fesor

Well, the number of articles you have is updated once a second? Maybe just when changing the number of posts, etc. clear the cache?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question