Join the community today
Register Now

Wordpress Redis Object Cache Issue wp_cache_set() WordPress Function

Discussion in 'Blogs & CMS usage' started by Saumya Majumder, Sep 30, 2016.

  1. Saumya Majumder

    Saumya Majumder Member

    60
    3
    8
    Mar 16, 2016
    Ratings:
    +12
    Local Time:
    1:03 AM
    1.9.12
    10.0.24
    Hi,
    I've recently discovered a very weird issue with redis Object Cache and WordPress's wp_cache_set() function. So, I'm explaining the problem here:

    As a WordPress dev myself, I've figured this issue first on my own WordPress plugin called WP Server Stats. Now as per WordPress best coding practices, I've used the wp_cache_set() function to keep valuable things in cache instead of re-quering them every time.

    Now it works fine on all server but on my main site where I use centminmod + redis object cache + redis front end cache, I saw that the fields that I was using with wp_cache_set is showing as blank:

    [​IMG]

    but it should be look like this:

    [​IMG]

    Hope you see the difference.
    Also on the other day I tried installing EWWW Image Optimizer Cloud on my server and after installing the plugin I was unable deactivate or delete it from my wp admin section. Also any changes I made to the plugin settings wasn't getting saved either. It was just keep reverting back to the initial stage.

    So, after I had a long discussion with Shane (author of EWWW), he said it might be causing due to the object cache. So, I tried disabling it temporarily and everything went back to normal.

    I can see my plugin working fine, EWWW Cloud working fine. All good. So, after I configured the EWWW, I again turn the redis object cache back on. To make sure my site remains fast.

    The reason I'm reposting this to you in hope you can find the problem behind it and fix it in upcoming v0.9 stable release.

    BTW, when v0.9stable is coming out?
     
    • Informative Informative x 1
  2. eva2000

    eva2000 Administrator Staff Member

    29,049
    6,591
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,786
    Local Time:
    5:33 AM
    Nginx 1.13.x
    MariaDB 5.5
    when beta testing of letsencrypt ssl certificate integration is stable (just needs users to beta test and provide feedback and bug reports) centminmod.com/acmetool :)

    yes it's redis object cache related, i believe latest 123.09beta01 no longer installs this wp plugin because of this and why new 123.09beta01 wp cache options mentions potential issues with redis cache and recommends keycdn cache enabler instead Beta Branch - Centmin Mod 123.09beta01 centmin.sh menu option 22 - add Redis cache support | Centmin Mod Community :)
     
  3. Saumya Majumder

    Saumya Majumder Member

    60
    3
    8
    Mar 16, 2016
    Ratings:
    +12
    Local Time:
    1:03 AM
    1.9.12
    10.0.24
    Thanks. Do you have a tutorial, which which I can disable redis cache on my site and enabler cache enabler instead (if it is better than redis server cache + redis object cache).

    Also please tell me what do you suggest me to do here? I want my site to be super fast. I use redis because I thought as it works at more core level, it will yield better result.
     
  4. eva2000

    eva2000 Administrator Staff Member

    29,049
    6,591
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,786
    Local Time:
    5:33 AM
    Nginx 1.13.x
    MariaDB 5.5
  5. Saumya Majumder

    Saumya Majumder Member

    60
    3
    8
    Mar 16, 2016
    Ratings:
    +12
    Local Time:
    1:03 AM
    1.9.12
    10.0.24
    But as a webmaster yourself, do you recommend using cache enabler over redis, if performance is concerned.
     
  6. eva2000

    eva2000 Administrator Staff Member

    29,049
    6,591
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,786
    Local Time:
    5:33 AM
    Nginx 1.13.x
    MariaDB 5.5
    Depends on if you know 100% whether wp plugins work with redis cache or not. If not use keycdn cache enabler :)

    @JarylW benchmakred keycdn cache enabler to be slightly faster for him than redis cache at nginx level
     
  7. Saumya Majumder

    Saumya Majumder Member

    60
    3
    8
    Mar 16, 2016
    Ratings:
    +12
    Local Time:
    1:03 AM
    1.9.12
    10.0.24
    No I mean from speed standpoint which one is faster? cache enabler or redis?
     
  8. eva2000

    eva2000 Administrator Staff Member

    29,049
    6,591
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,786
    Local Time:
    5:33 AM
    Nginx 1.13.x
    MariaDB 5.5
    for me was redis but @JarylW saw keycdn cache enabler

    think it depends on what you have installed on wordpress etc and styles etc too. Test both yourself and decide :D
     
    • Like Like x 1
  9. Saumya Majumder

    Saumya Majumder Member

    60
    3
    8
    Mar 16, 2016
    Ratings:
    +12
    Local Time:
    1:03 AM
    1.9.12
    10.0.24
    So, if I stick with redis, do you recommend me to disable the redis object cache wordpress plugin?
     
  10. eva2000

    eva2000 Administrator Staff Member

    29,049
    6,591
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,786
    Local Time:
    5:33 AM
    Nginx 1.13.x
    MariaDB 5.5
    yup
     
  11. Saumya Majumder

    Saumya Majumder Member

    60
    3
    8
    Mar 16, 2016
    Ratings:
    +12
    Local Time:
    1:03 AM
    1.9.12
    10.0.24
    OK thanks. but in that case, if I needed to flush the object cache is there any command that I can use?
     
  12. eva2000

    eva2000 Administrator Staff Member

    29,049
    6,591
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,786
    Local Time:
    5:33 AM
    Nginx 1.13.x
    MariaDB 5.5
    redis object cache settings has a clear cache button or just restart redis server
     
  13. Saumya Majumder

    Saumya Majumder Member

    60
    3
    8
    Mar 16, 2016
    Ratings:
    +12
    Local Time:
    1:03 AM
    1.9.12
    10.0.24
    Yes but you asked me to delete this plugin: http://puu.sh/rs2Qj/9f065e20d3.png

    That is why I'm asking for an alternative command
     
  14. eva2000

    eva2000 Administrator Staff Member

    29,049
    6,591
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,786
    Local Time:
    5:33 AM
    Nginx 1.13.x
    MariaDB 5.5
  15. JarylW

    JarylW Active Member

    213
    39
    28
    Jun 19, 2014
    Singapore
    Ratings:
    +99
    Local Time:
    3:33 AM
    Why disable the object cache? It still improves performance for wp-admin backend and when front page caching is disabled (logged in sessions for most cases), no?
     
  16. eva2000

    eva2000 Administrator Staff Member

    29,049
    6,591
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,786
    Local Time:
    5:33 AM
    Nginx 1.13.x
    MariaDB 5.5
    well backend admin side is usually going to be making changes to options which won't take effect until object cache is cleared, so probably not ideal unless you want to be purging cache everytime.
     
    • Informative Informative x 1