Skip to content

v2.3.5 - Fix Redis cache busting (stats stopping after post publish)

Choose a tag to compare

@hummelmose hummelmose released this 17 Jul 17:52
· 35 commits to main since this release

WP VisitChart v2.3.5

Bug fix: stats periodically stopping after post publication.


Root Cause

Two bugs were found in lstats_bust_transient_cache(), the function responsible for evicting cached API responses from Redis/Memcached when WP Rocket clears its cache after a post is published.

Bug 1 — Wrong transient keys
lstats_live_pages and lstats_top_pages were listed as keys to bust, but neither of these transients has ever existed in the plugin. The function was attempting to delete keys that were never set, while the actual transients (lstats_live_count, lstats_today_history, lstats_referrers, lstats_insights) remained cached in Redis.

Bug 2 — Wrong wp_cache_delete() group parameter
All wp_cache_delete() calls passed 'options' as the cache group. Redis does not store transients under the options group — they are stored in the default cache namespace. With the wrong group specified, wp_cache_delete was looking in the wrong place and the transient was never actually evicted from Redis, even though the WP Rocket hooks were firing correctly.


Fix

  • Removed non-existent keys from the bust list
  • Removed the 'options' group parameter from all wp_cache_delete() calls throughout the plugin so they correctly target the default Redis namespace
  • Added delete_transient() call alongside wp_cache_delete() in the bust function to ensure both the database and the object cache are cleared

Upgrade

Download wp-visitchart.zip below and replace the existing plugin files. No database changes required.