Voting does not update on my website

Server Administration ForumCategory: QuestionsVoting does not update on my website
corona_max asked 10 months ago PPU : 5

I implemented a voting feature for articles on my Drupal 7 website. The problem is that the votes are somehow not updating on the website. I can see it updated only when I am logged in.

Can anybody help me?

2 Answers
ranandstimpy answered 10 months ago

I think you have simply some cache enabled. You should check the caching methods in charge for the website. Static content is cacheable. Content for logged in users are in most cases excluded from the caching rules because dynamic content can not be cached.

Caching serves a static version of the rendered code from the ram of your server. The content has been already rendered before. Thats why you will probably see some older version of the website.

It is possible to purge the cache for specific pages on specified events. You can check Drupal if there is a plugin available which purges the cache in case of voting happened. If thats not the case you can add few lines of code withing the voting plugin so that on the event of voting some cache purging for this page happens.

willisupportz answered 10 months ago

Yes thats true. Alternatively you can set a cache lifetime to 30min or even a shorter time period. In this case users will see the updates with some short elay. Many websites do it this way.

Logged in users will see the website in realtime as content for logged in users will be served generally not cached.