Support » Plugin: WP Redis » Testing if Object Caching works

  • Resolved michacassola

    (@michacassola)


    Hi,

    how do I see if the plugin is working correctly with Redis?
    I have put this in the top of wp-config.php:

    $redis_server = array(
        'host'     => 'unix:/var/run/redis/redis.sock',
        'database' => 0,
    );
    
    define('NONCE_SALT', 'some text'); 
    define('WP_CACHE_KEY_SALT', 'example.com');
    define('WP_REDIS_USE_CACHE_GROUPS', true);

    But in the command line when running sudo redis-cli -s /var/run/redis/redis.sock monitor I just get OK but no output of any caching.

    How do I see if the plugin works?

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

    (@danielbachhuber)

    Great question, @michacassola. I’ll admit: there isn’t actually a simple way to detect whether the persistent object cache is working in the web UI.

    If you have WP-CLI installed on your machine, you can run a sequence of commands to detect if the cache is persistent:

    
    $ wp cache set foo bar
    Success: Set object 'foo' in group 'default'.
    $ wp cache get foo
    bar
    

    If the cache isn’t persistent, you’ll see an error for the second command:

    
    $ wp cache set foo bar
    Success: Set object 'foo' in group 'default'.
    $ wp cache get foo
    Error: Object with key 'foo' and group 'default' not found.
    

    Thank you for your reply!
    I get this:

    $ wp cache set foo bar --path="/home/admin/web/domain.com/public_html"
    PHP Notice:  Constant NONCE_SALT already defined in phar:///usr/local/bin/wp/php/WP_CLI/Runner.php(1020) : eval()'d code on line 65
    Success: Set object 'foo' in group 'default'.
    $ wp cache get foo --path="/home/admin/web/domain.com/public_html"
    PHP Notice:  Constant NONCE_SALT already defined in phar:///usr/local/bin/wp/php/WP_CLI/Runner.php(1020) : eval()'d code on line 65
    Error: Object with key 'foo' and group 'default' not found.

    What does this mean, is it working?

    And on a more important note: Cloud you please implement a feature to test if the caching is working or not?

    Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    What does this mean, is it working?

    Based on what you’ve shared, it doesn’t look like the persistent object cache is working.

    Cloud you please implement a feature to test if the caching is working or not?

    Filed away already as https://github.com/pantheon-systems/wp-redis/issues/46

    How do I fix the persistent cache from the error above. Do you need more info?

    Thanks for filing the issue.

    Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    How do I fix the persistent cache from the error above. Do you need more info?

    It’s hard to say without having access to the environment to debug.

    If you’re a Pantheon customer, you’re welcome to open a support ticket and a CSE will be able to sort it out for you. WordPress.org forum support is limited to basic Q&A.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Testing if Object Caching works’ is closed to new replies.