caching - Varnish: purge cache every time user hits "like" button -
i need implement like/dislike functionality (for anonymous users there no need sign up). problem content served varnish , need display actual number of likes.
i'm wondering how it's done on website stackoverflow. assuming pages cached in varnish (for anonymous users only), every time user votes on answer/question, page needs purged cache. right? current number of votes needs visible other users.
what approach in situation? should send purge
varnish every time user hits "like" button?
a common way of implementing button , display client side in javascript instead. avoids issue slightly.
assuming pressing leads post request hitting single varnish server, can make object invalidated/replaced in different ways. using purge , vcl restart better way this.
of course there slight race here, other clients served old page while ongoing.
Comments
Post a Comment