Description
A visit does not update the database. The page prints the current total and, after it has loaded, a tiny request adds one to a Redis counter. A scheduled check later copies those counters into post meta, and only while the clock is inside a window you set.
Default windows, India time (Asia/Kolkata):
- 3:00 AM to 12:00 PM
- 3:00 PM to 6:00 PM
Change the time zone, the hours, and how often the check runs under Settings PearlView Counter.
The total shown at the end of a post is the database value plus anything still waiting in Redis.
Requires a persistent object cache. Redis, via the Redis Object Cache plugin, is the expected setup.
Installation
- Upload the plugin zip in Plugins Add New Upload Plugin, then activate it.
- Install and enable Redis Object Cache so
wp-content/object-cache.phpis active. - Open Settings PearlView Counter and confirm the hours.
-
On a VPS, run real cron every 15 minutes so the 3:00 AM window still fires when the site has no visitors:
define( ‘DISABLE_WP_CRON’, true );
*/15 * * * * curl -s https://example.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
FAQ
-
Will a page view write to MySQL?
-
No. The view increments Redis. MySQL is updated only inside your write hours, or when an administrator uses “Write to the database now”.
-
What if Redis restarts before a window?
-
Pending counts that have not been written yet are lost. Totals already stored in post meta stay.
-
Does uninstall delete the counts?
-
No. Settings are removed. The
_pearlview_viewspost meta is left in place.
Reviews
There are no reviews for this plugin.
Contributors & Developers
“PearlView Counter” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “PearlView Counter” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.0.0
- First release. Redis counting, scheduled database writes, and a settings screen for the write hours.