• Hello,
    I am a huge fan of Plugin Organiser: have been using it for over 5 years and it’s brilliant!
    I am an optimisation fanatic. Plugin Organiser which saves my page dozens of database query is unfortunately now responsible for a full 25% (source: New Relic) of all my database transactions! And it’s now the slowest query on all my pages.
    The crazy thing is that it’s always the same query called on each page:

    SELECT disabled_plugins, disabled_mobile_plugins, disabled_groups, disabled_mobile_groups FROM wp_tpf_po_plugins WHERE post_type=? AND post_id=?
    (Source: Query Monitor)
    This query retrieves 54,000 rows and lasts 0.01s (my slowest query).

    My suggestion: could it not be possible to add this query to an object cache if one is detected (I use Redis).

    Here for instance is how I implemented object cache in my code (I’m nowhere as good a programmer as you are – just a thought to explore):

    $cachekey="ememberlevel".$photo_user_id;
    $membership_level = wp_cache_get( $cachekey );
    if ( false === $membership_level ) {
    	$membership_level = $wpdb->get_var("Select membership_level From  wp_tpf_wp_eMember_members_tbl Where user_name = '".$user_name."'");
    	wp_cache_set( $cachekey, $membership_lavel,'',86400);
    }

    In advance thanks for your consideration and your outstanding work on the plugin.

Viewing 1 replies (of 1 total)
  • Thread Starter xberg

    (@xberg)

    I went ahead and changed line 77 in /mu-plugins/PluginOrganizerMU.class.php to this to move that transaction into object cache (redis in my case). Tested and working:

    $cachekey="pluginorganiser";
    $storedPluginLists = wp_cache_get( $cachekey );
    if ( false === $storedPluginLists ) {
        $sql = "SELECT disabled_plugins, disabled_mobile_plugins, disabled_groups, disabled_mobile_groups FROM ".$wpdb->prefix."po_plugins WHERE post_type='global_plugin_lists' AND post_id=0";						
        $storedPluginLists = $wpdb->get_row($sql, ARRAY_A);
        wp_cache_set( $cachekey, $storedPluginLists,'',600);
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Optimisation suggestion of Plugin Organiser’ is closed to new replies.