cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New

Disable object caching in PHP

I maintain a WordPress plugin that sets data with set_transient, which works fine 99.99% of the time. But sometimes it fails, and when it does the site always uses object caching.

 

Before this happened sometimes with users using W3 Total Cache, but now in this week alone I had three customers contact me, and they all had the same hosting platform. GoDaddy Managed WP hosting.

 

I end up telling clients to simply rename the object-cache.php in the wp-content folder to something else, and it start to work again. But it would be nice if there was another way other then forcing them to login with FTP and rename files on the server to fix this.

I'm aware you can skip the cache by adding a param to the URL, but this of course won't work in this case. The transient value just seems to disappear in a black hole. So it would be nice if there was PHP code available that allows me to simply temporarily disable the object caching while I run the code in the plugin.

 

Does this exist, or is the renaming the object-cache.php really the only way to work around this?

3 REPLIES 3
Helper VI
Helper VI

Re: Disable object caching in PHP

Hello @Tijmen

 

The problem regarding object-cache.php file, has been discussed a few times lately, and the GoDaddy's employees told us that they are working to solve that problem.

So far, the only "solution" is to rename that file.

I have a few WordPress sites under my care, but I was not affected by that error.

I think (but I'm not at all sure) that the problem is limited to the Managed WordPress hosting plan (and I don't use that).

 

That is all I know on the subject, maybe someone can tell you more.

 

Good luck.

🙂

***Signature: -> Do not assume anything! If you want help, explain your problem. If my post helped you, give it a Kudo. If you have the solution, mark the topic as Solved.
New

WordPress transients not working

Hi there,

 

It seems that on managed WP, the WP transients API is not working ( https://codex.wordpress.org/Transients_API ). I'v'e made some investigations and it seems to be related to the caching mechanism you have in place. As a temporarry fix, i can bypass these problems by disabling the cache  using wp_using_ext_object_cache( false );

 

As a test case, you can follow these steps : 

1. Use the following code to set a transient:

    set_transient( 'my_transient_test', 'sample_value' );
  1. After running the code at least once, delete the line from step 1 ( at this moment, the transient value should be saved to the databases )
  2. Add the following code to retrieve the transient :
    $saved_transient = get_transient( 'my_transient_test' );
    var_dump( $saved_transient );
  1. After running this code, you will get a false value event if it was set at step 1.

 

Best regards,

Stefan 

Re: WordPress transients not working

Part of the issue in managed wordpress is a simple programming error in object-cache.php on line 242. A function called incr2() for the WP_Obect_Cache( I think) class is used but undefined, although it does exist and is defined in the object-cache.php.apc. It ought to simply be incr()