A
A
Anton Ivanov2016-03-30 01:03:34
Nginx
Anton Ivanov, 2016-03-30 01:03:34

What is the best way to organize page caching when one block should not be cached?

Hello.
The question is in the title. It is necessary that 99% of the page is cached, and the content of one block changes as soon as the file with the content of this block changes on the server. Loading with Ajax is not an option (it takes a long time to explain why).
Since this block is used on almost all pages, it is obvious that clearing the cache for this is not an option.
I know that this can be done with varnish (Edge Side Includes, if I'm not mistaken), I'm wondering if nginx has the same mechanism.
Well, I want to hear an opinion from experienced people on how this is done "according to standards", since I'm a "newbie" in caching :)
Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav Skillz, 2016-03-30
@Fly3110

To disable block caching, you can set the cache_lifetime internal attribute to null in the block constructor:
protected function _construct() {
$this['cache_lifetime'] = null;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question