WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
With Persistent Caching get_option returns old values of option despite upd (2 posts)

  1. vickybiswas
    Member
    Posted 3 years ago #

    Redirected here from http://core.trac.wordpress.org/ticket/17519

    We use wordpress 3.x on different installations for our high traffic sites.

    We use persistent caching using W3 Total Cache object cache which is set to read from our memcached servers

    Intermittently we noticed cron set but not running, options set but not returning the right value

    On digging deeper we found that when concurrent pages are loading a race condition existed which over wrote the new values with old values.

    Screen shot attached will display what we mean here. We created a test page which did the following

      read option value from db
      dump the object from step 1
      get_option
      display value received in step 3
      update option
      get_option
      display value received in step 7
      read option value from db
      dump the object from step 8
      Stop

    The output in the screenshot shows that get option was returning a cached copy of the option although the db contained a later value.

    Way to recreate using above algo Platform WP ver 3.x with W3 Total Cache

    Settings W3 Total Cache object caching on using memcache servers

    Code

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Open this page in 4 windows and refresh these page consecutively a few times you would notice mismatch in db and fetch values like the second screenshot which shows the db reflecting 9 get option fetches 7 after update both show 10 but parallely if we open this in another widow we would still get 7 using get_option

    We did a similar script for testing cron with similar results

    Starting script
    [Code moderated as per the Forum Rules. Please use the pastebin]

    If you notice the cron finally contained A_6 and A_5 was lost as if it never existed in the cron.

    Solution We used a temporary solution as follows

    [Code moderated as per the Forum Rules. Please use the pastebin]

    We invalidated the cache for cron when we needed to set the value. So that it reads from the db and updates.

    Still Looking for a permanent Solution not sure despite updating the object cache why get_option returns old value.

    http://wordpress.org/extend/plugins/w3-total-cache/

  2. Frederick Townes
    Member
    Plugin Author

    Posted 3 years ago #

    Can you please provide the moderated code?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic