I faced an issue which I can’t cope with. I’m forced to use PHP
fastcgi
cache in NGINX
to reduce server load. Such approach works perfectly, but since I use sessions, I need to configure NGINX
somehow to return not cached content (or its part) to the visitors who are logged in.
I can’t figure it out since I can learn if user is logged in by checking his session.
if (!isset($_SESSION['subscr_loggedin']) ||
$_SESSION['subscr_loggedin'] !== true) {
...
}
I suppose I need use SSI
. However, this method allows to exclude the cache from some PHP
template while I need to exclude some functions.
For instance, my visitor can track and collect the TV shows. When he pushes a "track" button, the show adds to his collection. And he must see that the show is tracked when he comes back to the same page! But, if it the page is already cached, the visitor sees that something went wrong since the content is not updated.
So, I have just two options I suppose:
- Forbid NGINX cache the content for all the visitors who are logged in;
- Don’t cache some blocks on my page. But there are so
few data about the usage of
SSI
.
Both options are acceptable for me. Can anyone assist me with such an issue?