Support » Plugin: WP Redis » Disabling Redis OC for REST API

  • Resolved Luka

    (@darktwen)


    Hello,

    We would like to disable Redis Object Caching for REST API or for this endpoint specifically:

    /wp-json/rnlab-app-control/*

    As it’s causing issues.

    Is this possible?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    Hi @darktwen,

    I think Redis Object Caching is a different plugin than WP Redis.

    In either case, I wouldn’t recommend conditionally disabling your persistent object cache. The data in the object cache could get out of sync with the data in the database.

    Thread Starter Luka

    (@darktwen)

    We are using your plugin, the one with a slug wp-redis

    https://wordpress.org/plugins/wp-redis/

    Please let us know how to do this, we are not concerned about out of sync because this endpoint is used just for specific functionality that isn’t used anywhere on the site.

    Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    Hi @darktwen,

    Something like this as your wp-content/object-cache.php file might work (untested):

    
    <?php
    
    if ( false === stripos( $_SERVER['REQUEST_URI'], '/wp-json/rnlab-app-control/' ) ) {
    	require_once __DIR__ . '/plugins/wp-redis/object-cache.php';
    }
    

    It will conditionally load the actual object-cache.php based on the request URI.

    I’m not sure how reliably this will work though, if at all.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.