Support » Plugin: Optimum Gravatar Cache » Gravatar cache doesn’t seem to be updating based on the frequency set

  • ResolvedPlugin Contributor Will Stocks

    (@willstockstech)


    Hey @jomisica

    I hope you are well?

    I changed my Gravatar image late last week to a new image. I was expecting to see this reflected on my site within a day or two (I have the “check for outdated gravatars” set to every 1 day and check every 5 minutes), however it did not update!

    I thought maybe it was something to do with my site’s caching plugin, so I cleared my site cache – no change.

    I tried “sync users and commenters now” in the plugin – nothing happened at all.

    I then had to clear the gravatar cache (the button is/was disabled for some reason, so I enabled the button by editing the html and removing disabled=”disabled”) which meant I could click the button and the cache then emptied.

    My new gravatar then started to show and started caching (although I had to navigate through all pages that have a gravatar for it to cache each correct image).

    Any idea why this would/did happen?

Viewing 15 replies - 1 through 15 (of 50 total)
  • Plugin Author José Miguel

    (@jomisica)

    Hello @willstockstech

    I’m fine thank you!

    I’ve analyzed how your gravatars are being served.
    From what I’ve noticed from the server’s response headers, it caches the gravatar for about a month:

    date: Thu, 15 Nov 2018 09:46:46 GMT
    content-type: image / jpeg
    content-length: 9200
    last-modified: Tue, 13 Nov 2018 14:49:03 GMT
    etag: “23f0-57a8ceb2a95c0”
    cache-control: max-age = 2592000
    expires: Sat, 15 Dec 2018 09:34:09 GMT

    With this configuration it will not be possible to present to users an updated gravatar in a maximum of two days.

    I recommend trying the “query string” option.

    I have an account on gravatar.com that I use for testing in the plugin, I update regularly and it changes perfectly.

    I’m not saying it can not be a bug.

    To try to understand where the problem comes from is this:

    1. Update the gravatar again on gravatar.com;
    2. Let 3 days pass;
    3. Check via ftp if the gravatar in your cache directory has been updated.

    If the gravatar was not updated in your cache directory can be a problem with the plugin, if it was updated is certainly a problem with the server cache configuration.

    Plugin Contributor Will Stocks

    (@willstockstech)

    Thanks @jomisica – I will check the .htaccess file on the cache folder as I assume it’s something in there?

    If not, I will try the query string option (although at the moment I strip query strings from WordPress via a simple function – hopefully it won’t strip these!) 🙂

    Plugin Contributor Will Stocks

    (@willstockstech)

    So my top level .htaccess file has the following rules:

      <FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$">
       ExpiresDefault A2592000
       </FilesMatch>

    and

      <FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$">
       Header set Cache-Control "max-age=2592000"
       </FilesMatch>

    Which is resulting in this header being set. I’ve just noticed there’s no .htaccess in my gravatar cache folder… If I set one up with a lower value specifically in the cache folder, it should overrule the top-level .htaccess right?

    Plugin Author José Miguel

    (@jomisica)

    Yes, it in principle overrides the top-level .htaccess rules.

    Plugin Contributor Will Stocks

    (@willstockstech)

    So if I just use the “template” version you supply as part of the plugin and put that in my \gravatar\cache\ folder, that should sort my issue?

    I’ll setup the cache-control header to 2 days (cache-control: 172800) and ExpiresDefault A172800

    I will try enabling the query string as well, to cache bust!

    Plugin Author José Miguel

    (@jomisica)

    In principle yes, but it is necessary to experiment, there may be some incompatibility with the modules on your server.

    I can help solve if there is a problem.

    Plugin Contributor Will Stocks

    (@willstockstech)

    Thanks! 🙂
    I think I was using this template prior to this version when we were doing a little “testing”
    I’ll let you know how it goes

    Plugin Contributor Will Stocks

    (@willstockstech)

    If I click “sync users and commenters now” – should that essentially “force refresh” my cache on demand?

    Plugin Contributor Will Stocks

    (@willstockstech)

    Also, I have now enabled the query string option. I was expecting to see:
    ?d=[modification date] reflected as something like ?d=151120181430 but instead I’m seeing: ?d=tcmsvx?
    I now have set:
    Refresh gravatars cache every: 1 days
    Search for outdated avatars every: 5 minutes

    If I click “Sync users and commenters now” – nothing seems to happen at all. The page refreshes, but nothing happens. I have also applied the .htaccess file in my cache folder and it has lowered the cache-control to 24 hours 🙂

    • This reply was modified 1 year, 2 months ago by Will Stocks.
    Plugin Author José Miguel

    (@jomisica)

    “Sync users and commenters now” only announces the email of users and commentators to the plugin, however their avatars will be built in the background.

    The dates “?d=151120181430” are converted to base 35 “?d=tcmsvx” to save characters, but does the same job.

    Plugin Contributor Will Stocks

    (@willstockstech)

    OK – so it doesn’t “force update” gravatars when I click the button. Does it still wait for the cache time limit to be hit before checking for new avatars? Only reason I ask, I hit that button half an hour ago (no new users/commenters) thinking that it would simply do an “on demand” refresh of the gravatars. Nothing has changed in that half an hour window 🙁

    Ahhh, OK that makes sense! I thought it’d be some form of date formatting I just couldn’t work out which type of encoding it was using haha!

    Plugin Author José Miguel

    (@jomisica)

    Will now just wait a day or two and will check that it has been updated.
    Do not clean your cache now, otherwise you’ll go back to the beginning.

    Plugin Contributor Will Stocks

    (@willstockstech)

    OK, I will wait for a day or two 🙂

    Plugin Author José Miguel

    (@jomisica)

    However if you want to rush things.
    Edit the plugin file and substitute it in line 1859:

    $time=time()-$this->expireTime * 86400;//86400 1 day

    per
    $time=time()-$this->expireTime * 1;//86400 1 day

    and wait a while that the cache will start updating all the gravatars.

    Plugin Contributor Will Stocks

    (@willstockstech)

    Ooooh….

    I think just to make sure, I’ll leave it to run it’s course properly 🙂

    I’ll check my site again in 24 hours, which would be the “1 day” window per:
    Refresh gravatars cache every: 1 days

    If the cache only refreshes once every day as a minimum, what exactly does:
    Search for outdated avatars every: 5 minutes
    this do? Does it just check for outdated gravatars every 5 minutes and flag them as needing to be refreshed every expireTime days?

Viewing 15 replies - 1 through 15 (of 50 total)
  • The topic ‘Gravatar cache doesn’t seem to be updating based on the frequency set’ is closed to new replies.