Support » Plugin: Servebolt Optimizer » Verify menu cache and text domain translation cache

  • How can we verify menu cache and load translations from cache is working as it should? Where is the cache stored?

    I checked the transients but doesn’t seem to see any menu cache or text domain related transients.

    Any chance the menu cache could speed up /wp-admin/nav-menus.php as well? This tends to be extremely slow once you work and scroll on a large single menu with several of sub menu items.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter Rookie

    (@alriksson)

    @wizzard_ @robertservebolt any respond on this?

    Plugin Support Pieter

    (@wizzard_)

    Hi there Rookie!

    There have been some changes in the plugin lately. What version are you currently running on your site?

    Thread Starter Rookie

    (@alriksson)

    @wizzard_ Latest version of the plugin 5.7.2 version of wordpress.

    Thread Starter Rookie

    (@alriksson)

    @wizzard_ Is it working as it should with redis object cache? Disabled redis instance in wordpress and now I see the sb-menu-cache* in the transients. But can still not see any text domain translation cache.

    • This reply was modified 5 months ago by Rookie.
    Plugin Support Pieter

    (@wizzard_)

    Hello! Sorry about the delayed response.

    We need to separate your question into two parts – first the question regarding the menu cache-feature:

    You can verify that the feature is working by inspecting the source code of a page where a menu is present. But first we need to add some code to your site for the purposes of debugging:
    add_filter('sb_optimizer_menu_optimizer_print_cached_comment', '__return_true');

    Usually you would typically add this to your functions.php-file in your theme, or perhaps a PHP-file in the “wp-content/mu-plugins”-folder.

    This code will result in a comment in the source code telling you whether the menu was retrieved from the cache or not. The comment is formed like this:
    <!-- This menu is cached by Servebolt Optimizer -->.

    Regarding where is the cache stored – the cache is stored in WordPress transients which in turn is stored in the “wp_options”-table. The transient key will start with the string “sb-menu-cache-“. You would need to inspect your database-tables to see the cached data.

    Note that we have a v3.4 release coming up (no formal release date yet) that will improve the menu cache feature, and increase the compatibility for various themes and plugins. So if you are seeing issues with the menu cache feature then you might possibly want to wait for the v3.4-release and test again then.

    Regarding the translation loading cache feature – there is currently no way to confirm that the feature is working (other than debugging the code manually). The translation cache is also stored in WP transients. The transient key is a md5 hash of the path to the MO-file. Unfortunately no prefix so these rows are hard to spot in the “wp_options”-tables.

    Thread Starter Rookie

    (@alriksson)

    You can verify that the feature is working by inspecting the source code of a page where a menu is present. But first we need to add some code to your site for the purposes of debugging:
    add_filter('sb_optimizer_menu_optimizer_print_cached_comment', '__return_true');

    Usually you would typically add this to your functions.php-file in your theme, or perhaps a PHP-file in the “wp-content/mu-plugins”-folder.

    This code will result in a comment in the source code telling you whether the menu was retrieved from the cache or not. The comment is formed like this:
    <!-- This menu is cached by Servebolt Optimizer -->.

    No success the html comment can not be found, even disabled removing HTML comment in asset clean up. But I see the transients once disabled redis object cache. Also once adding your filter redis object cache is disabled. Added in code snippet with run everywhere priority 10.

    Regarding where is the cache stored – the cache is stored in WordPress transients which in turn is stored in the “wp_options”-table. The transient key will start with the string “sb-menu-cache-“. You would need to inspect your database-tables to see the cached data.

    Thanks yes noticed that once I dug deeper, thanks for clarifying.

    Note that we have a v3.4 release coming up (no formal release date yet) that will improve the menu cache feature, and increase the compatibility for various themes and plugins. So if you are seeing issues with the menu cache feature then you might possibly want to wait for the v3.4-release and test again then.

    Okay sounds interesting, what kind of timeline without making promises?

    Regarding the translation loading cache feature – there is currently no way to confirm that the feature is working (other than debugging the code manually). The translation cache is also stored in WP transients. The transient key is a md5 hash of the path to the MO-file. Unfortunately no prefix so these rows are hard to spot in the “wp_options”-tables.

    Okay will you improve this somehow? Yeah not ideal to identify working or not, is the expiration persistent? As the menu cache is 6 months. Then I might have found them but yes as you say not easy to find them.

    Was thinking about md5 hash decoder but might be extra annoying to decode due to salt keys or any easy and fast way?

    Are they suppose to work with redis object cache?

    Plugin Author robertservebolt

    (@robertservebolt)

    Hello again!

    Menu cache feature
    Sorry to hear that the menu cache-feature is still not working as expected. I suspect that our feature is unfortunately incompatible with your theme. As mentioned earlier I do think that our upcoming release will fix this.

    In regards to the timeline of release – my guesstimate is that the release will happen some time in late January next year, or early/mid February. But again, I cannot make any promises.

    MO-file cache feature
    Regarding the MO-file cache feature – I’ve added a prefix to the transient name, so that one can more easily debug whether the MO-file is cached or not. The prefix is “sb-optimizer-text-domain-loader-“.

    The feature is quite simple from a code perspective, and as long as there are no conflicts in regards to the “override_load_textdomain”-filter it should work as expected.

    The transient expiration happens whenever the file is updated, since we’re using the file modification time. So – as long as the MO-file is not updated on the disk then the cached version will persist in the database. If the file is updated, then the cache will be updated. So this should sort itself out.

    In regards to Redis – our feature is built on top of WordPress-functions, so if the Redis configuration work with WordPress then it should work with our feature as well. I do know that one can exclude transients from Redis, so you would need to ensure that this is not the case for you.

    I hope this answered your questions. Feel free to elaborate/reach back if something is still unclear.

    Kind regards
    Robert Sæther
    Servebolt

    Thread Starter Rookie

    (@alriksson)

    Menu cache feature
    Sorry to hear that the menu cache-feature is still not working as expected. I suspect that our feature is unfortunately incompatible with your theme. As mentioned earlier I do think that our upcoming release will fix this.

    In regards to the timeline of release – my guesstimate is that the release will happen some time in late January next year, or early/mid February. But again, I cannot make any promises.

    It doesn’t seem to work smoothly, especially with redis cache it doesn’t seem to work. I use oxygen page builder on the site I tested it on. Thanks for the guesstimate hope to see it out as soon as possible.

    MO-file cache feature
    Regarding the MO-file cache feature – I’ve added a prefix to the transient name, so that one can more easily debug whether the MO-file is cached or not. The prefix is “sb-optimizer-text-domain-loader-“.

    The feature is quite simple from a code perspective, and as long as there are no conflicts in regards to the “override_load_textdomain”-filter it should work as expected.

    Thanks for adding the prefix to the transient name, it will make it easier for sure. Okay that make sense yeah as said there can be conflicts with plugins or themes. In my case custom strings via WPML or via locotranslate, Main plugin is oxygen so no theme on the site I tested it on.

    The transient expiration happens whenever the file is updated, since we’re using the file modification time. So – as long as the MO-file is not updated on the disk then the cached version will persist in the database. If the file is updated, then the cache will be updated. So this should sort itself out.

    Understood, I just saw a long expiration date and as there was no prefix I assumed it was that one.

    In regards to Redis – our feature is built on top of WordPress-functions, so if the Redis configuration work with WordPress then it should work with our feature as well. I do know that one can exclude transients from Redis, so you would need to ensure that this is not the case for you.

    Transient should be cached n the redis configuration, and it should not be ignored https://wordpress.org/support/topic/are-transients-saved-to-redis-too/
    transient is not in the ignored group.

    Status: Not connected
    Client: PhpRedis (v5.3.4)
    Drop-in: Valid
    Disabled: No
    Ping: 
    Connection Exception: Connection refused (RedisException)
    Errors: [
        "Connection refused"
    ]
    PhpRedis: 5.3.4
    Predis: Not loaded
    Credis: Not loaded
    PHP Version: 7.4.26
    Plugin Version: 2.0.22
    Redis Version: Unknown
    Multisite: No
    Metrics: Disabled
    Metrics recorded: null
    Filesystem: Working
    Global Prefix: "wp_"
    Blog Prefix: "wp_"
    WP_REDIS_PREFIX: "dev.example.com"
    WP_CACHE_KEY_SALT: "dev.example.com"
    Global Groups: [
        "blog-details",
        "blog-id-cache",
        "blog-lookup",
        "global-posts",
        "networks",
        "rss",
        "sites",
        "site-details",
        "site-lookup",
        "site-options",
        "site-transient",
        "users",
        "useremail",
        "userlogins",
        "usermeta",
        "user_meta",
        "userslugs",
        "redis-cache"
    ]
    Ignored Groups: [
        "counts",
        "plugins",
        "themes",
        "blog-details",
        "blog-id-cache",
        "blog-lookup",
        "global-posts",
        "networks",
        "rss",
        "sites",
        "site-details",
        "site-lookup",
        "site-options",
        "site-transient",
        "users",
        "useremail",
        "userlogins",
        "usermeta",
        "user_meta",
        "userslugs",
        "redis-cache",
        "blog_meta"
    ]
    Unflushable Groups: []
    Drop-ins: [
        "advanced-cache.php v by ",
        "Redis Object Cache Drop-In v2.0.22 by Till Krüss"
    ]

    I hope this answered your questions. Feel free to elaborate/reach back if something is still unclear.

    Many thanks for the answers.

    Thread Starter Rookie

    (@alriksson)

    @robertservebolt Was this fixed in the latest version of the plugin?

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