Support » Plugin: APC Object Cache Backend » [Plugin: APC Object Cache Backend] After installation, transients stopped working

  • I haven’t been able to run a lot of diagnostics on this yet, but after installing APC Object Cache Backend, the transients I was setting are returning false with get_transient().

    What should I be looking into to get to the bottom of this? My understanding is that if the persistent object cache is available, transients are no longer set in wp_options, but within the cache. Is this right?

Viewing 8 replies - 1 through 8 (of 8 total)
  • It’s important to note that as soon as I removed the APC Object Cache Backend file, the transients were being properly set and found again. This more than anything else, points to something related to APC Object Cache Backend.

    In a nutshell, here’s what I’m doing…

    Generate the transient key using a hash that’s comprised of the user login, email and timestamp.

    // Transient keys need to be less than 45 characters in length. wp-hash generates a 30-character string, but still, to be safe...
    $transient_key = substr( wp_hash( self::$registering_user->user_login . self::$registering_user->user_email . 'validate' . time() ), -30 );

    Set the transient and store the user ID
    if ( set_transient( $transient_key, self::$registering_user->ID, self::EMAIL_VALIDATION_TIMEOUT ) ){

    (I should note that… const EMAIL_VALIDATION_TIMEOUT = 28800; // 8 hours )

    Generate a URL that I email to the user’s email. It includes a query arg ‘k’ which contains the transient key for the transient we just created.
    $validation_url = add_query_arg( array( 'action' => 'validate', 'k' => $transient_key ), site_url( self::REDIRECT_LOGIN_FORM ) );

    Then that all gets sent to the user. Once the user clicks that link…

    if ( $transient_key = $_REQUEST['k'] ){
      if ( $user_id = get_transient( $transient_key ) ){ // THIS is where we end up with APC Object Cache Backend DISABLED. }
      else { // throw error message - THIS is where we end up with APC Object Cache Backend ENABLED. }

    The only thing I __don’t__ know at this point is whether the transient is set, but can’t be read back, or whether it never gets set in the first place.

    having the same issue – my post here:

    I have checked the database – when APC Object Cache Backend is enabled, the transients are not being written to the wp-options table like they normally are.

    Meeble – thanks for posting this. Sounds like you experienced exactly the same issues I did.

    Hey Mark, I know you’re super busy, but is this something you might get the chance to look into, say, after 3.5 is out? Would be great to be able to use your plugin with transients.

    Plugin Author Mark Jaquith


    WordPress Lead Dev


    • What version of APC?
    • What version of the backend?
    • What version of WordPress?
    • Single server situation?
    • Are you absolutely sure the keys are the same? Try a simpler script, where you set the transient ‘foo’ to ‘bar’ and then check it (and then again with the set line commented out, to check permanence).

    meeble — I’ll answer you on your thread.

    Plugin Author Mark Jaquith


    WordPress Lead Dev

    Here’s a simple test script:

    include( 'wp-load.php' );
    set_transient( 'foo', 'bar' );
    var_dump( get_transient( 'foo' ) );

    Try it once like that, then comment out the set_transient() line and refresh.



    Hi Mark, I did the transient test on a WP 3.5 Multisite with APC Object Cache Backend 2.0.6 running on VPS with Debian Squeeze, Nginx 1.3.3, PHP-FPM 5.3.20 and APC 3.1.9

    Both times, the request showed me

    string(3) "bar"

    But then I removed wp-content/object-cache.php, refreshed and got:


    And moving the object-cache.php back into place, the old bar value is echoed again…

    Does this not indicate that the transient did indeed NOT make it into the database?



    Oh, forgot to mention: WP Super Cache 1.2 is running network activated (in PHP mode but NOT using the experimental Object Cache feature) alongside all this. Could that influence anything?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: APC Object Cache Backend] After installation, transients stopped working’ is closed to new replies.