
內容簡介
假設有一個高流量的網站需要使用文章觀看次數來顯示首頁的文章。同時,該網站還使用了Varnish Caching,因此我們需要一個基於 AJAX 的文章觀看次數計數器。
現在想像一下同時有至少5000個用戶瀏覽網站,因此我們不能使用預設的“插件中的 AJAX”,因為使用update_post_meta在後端的即時更新將對後端造成極大的負擔。
那麼我們該怎麼辦呢?
假設所有這些文章觀看次數都是使用Redis在內存中完成的?
然後,我們使用WP-CLI運行cornjob將Redis中的文章觀看次數同步到WordPress數據庫中。
Redis Post Views應運而生。
外掛標籤
開發者團隊
原文外掛簡介
Imagine a high traffic website that needs post views as an algorithm to display posts on the homepage.
This website also uses Varnish Caching. So we need an AJAX based post views counter.
Now imagine a minimum 5000 concurrent users browsing the website, so we can’t use the default “AJAX in Plugins” as live updates on the backend using update_post_meta will be very painful for the backend.
So what can we do ?
What if all these post views counts will be done in memory using Redis ?
Then we run a cornjob using WP-CLI to sync the post views count in Redis to the WordPress database.
Redis Post Views was born.
