jaredatch / Shared-Counts

WordPress plugin that leverages SharedCount.com API to quickly retrieve, cache, and display various social sharing counts.
GNU General Public License v2.0
47 stars 16 forks source link

Force refresh all counts #37

Closed JiveDig closed 6 years ago

JiveDig commented 6 years ago

Last issue for today, I promise ;P

Testing Shared Counts on a site with a bunch of shares already. The counts don't populate unless I manually click refresh when editing each post/page individual. Obviously impractical. I'd love to have a "refresh all counts" button that just loops through all the posts and hits the API(s).

FWIW, I installed over 24hours ago, so it had time to hit the API. Also flushed cache.

Current Behavior

Posts only show actual counts when manually refreshing, after first install.

Expected Behavior

Posts would show correct/current counts.

billerickson commented 6 years ago

There is a prime the pump function for bulk retrieving counts, but we don't expose an API for it. We didn't want clients to use it all the time and hammer the APIs.

Try installing my Shared Counts - Prime Cache plugin which adds a simple settings page that lets you:

  1. Check current cache coverage
  2. Bulk update posts that don't have share data.

Also, remember that it takes 2 uncached hits to get updated counts on the frontend. The first uncached hit retrieves old counts and sees they are stale. If they are, it adds the post ID to the "needs updating" array which runs on shutdown to prevent slowing the page down for the user. The second uncached hit retrieves the new counts when the page is built.

JiveDig commented 6 years ago

Rock on. I don't need it in the core plugin and totally get why you left it out. I'd love to see it documented here in the repo though (wiki?), cause i'm sure many of was would lot to do it when migrating sites. Thanks!