Support » Plugin: Redis Object Cache » Deleting specific option from cache and redis

  • Resolved samwebdev

    (@samwebdev)


    Hello,

    Trying to update a specific option value for use get_option and retrieving the new value to use;

    if a plugin doesn’t implement a cache group, its not possible to delete it from cache specifically.

    So instead, trying to delete options cache before get_option to get the new value (it would be better to prevent options table from cache but it doesn’t seem to be possible)

    $GLOBALS[‘wp_object_cache’]->delete( ‘your_option_name’, ‘options’ );

    should technically delete it, but the redis cache doesn’t get deleted.

    wp_cache_flush does delete it, but it also deletes all cache.

    Is there another step to call after

    $GLOBALS[‘wp_object_cache’]->delete( ‘option_name’, ‘options’ );

    and before

    get_options(‘option_name’);

    to get the new value?

    Thanks

Viewing 1 replies (of 1 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    If your option is “autoloaded” then, no that’s not how it works.

    I’d suggest studying the get_option() more.

    You’ll also find the pre_option_{$option} filter there which allows you to bypass the cache for individual options.

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