The MU forums have moved to WordPress.org

Using wp-super-cache to cache plugin content (3 posts)

  1. iolaire
    Member
    Posted 14 years ago #

    I'm trying to follow the steps to cache plugin content at:
    http://dougal.gunters.org/blog/2006/07/21/using-the-wordpress-object-cache

    It looks like a fairly simple process. However I can not get the cache to work on the plugin level. For example I create a new plug in as follows, outputting "I've been cached at " and the current second, each time I generate the page it has a new second, rather than the pervious second.

    <?php
    /*
    Plugin Name: ilm_test
    Plugin Script: ilm_test.php
    */
    function ilm_test_showhtml($param1 = 0, $param2 = "test") {
    $mydata = wp_cache_get('mysettings', 'mycache');
    if (false === $mydata) {
    $mydata = "I've been cached at " . date('s');
    $myexpire = 60 * 60 * 24; // Cache data for one day (86400 seconds)
    wp_cache_set('mysettings', $mydata, 'mycache', $myexpire);
    }
    echo $mydata;
    return $ilm_test_html;
    }
    ?>

    Any suggestions on how to make this work well using the swp-super-cache plugin?

    My goal is to re-write the recent posts and most popular categories to be cached, in addition to the standard page caching. The 62+ quires per page load kills my page load time.

  2. tdjcbe
    Member
    Posted 14 years ago #

    However I can not get the cache to work on the plugin level.

    That's because the object cache was removed a few versions ago.

    I'd give you some links but it appears both searching and profile lookups are not currently working. There are other object cache plugins available. It's been discussed previously. If you can find Donncha's threads for 1.5 and 1.5.1, they were discussed as some length.

    If by swp-super-cache you mean Donncha's plugin, that should be doing it automatically as all that does (as I understand it) is save the page content of logged out visitors as static files and reserves that to anyone else who comes along.

  3. iolaire
    Member
    Posted 14 years ago #

    Thank you, the file based version mentioned at: http://mu.wordpress.org/forums/topic.php?id=5405 worked for my test plug in. When I tried to move it to storing a list of 24 links it didn't store the info. I'll need to work with it more, but for now it seems to be working.

About this Topic