2/15/2004 ↓

Finished some preliminary work on WordPress Caching

Author: Mark Ghosh Category: WordPress Hack

Thanks for visiting! If you're new here, you may want to subscribe to our RSS feed. This blog posts regular Wordpress news, updates of themes, plugins, ideas, hacks, quick fixes and everything about blogging, especially about Wordpress. Go ahead, subscribe to our feed! You can also receive updates from this blog via email.

Here are some examples:
Here is a WordPress 1.1 beta blog showing 300 posts.
Here is the same blog, cached with my method

Take a quick look at the bottom of the page for the generation times. The number in small letters in the center is for the main entries to be generated and displayed and the larger number to the left is the time for the whole blog to be generated.

A little more work is required to make this a functional hack. The categories and comments sections (along with archives and others) do not use the cache at this point to display the pages. Only the index page uses the cached entries and produces all the right links. Consequently, some more work is required to update the cache when some information is edited or added. This could include adding or editing a post or addition of comments and/or trackbacks. However, with a larger numbers of posts and links, this cache speeds things up quite a bit from what I can tell. I had to mess around with quite a few of the functions to get them to work correctly with storing a variable instead of echoing them. If someone is interested in the code, leave a comment or email me.

What do you think? Is this something worth investigating further?

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
Sphere: Related Content | stumbleit |

Visitors who read this post, also read:

Translate to German Translate to Spanish Translate to French Translate to Italian Translate to Portuguese Translate to Japanese Translate to Korean Translate to Russian Translate to Chinese

Latest Videos

Latest WordPress Jobs

4 Comments | Leave a comment | Comments RSS

  1. Hi, I was thinking the same thing a couple of times already. For my webpages I use PEARs CacheLite. But you don’t need to change wordpress to dump its output into variables, use phps’ caching functions. Here is an example of how I do it. This is the the top and the bottom of a webpage:


    $cache"bands";
    $cache = new Cache_Lite($cacheOptions);
    if ($data = $cache->get($cacheId)) {
    die($data);
    }
    ob_start();

    // put whatever php/html here

    $cache->save(ob_get_contents());
    ob_flush();

    Hope this helps…

    Lennart — 02/15/2004 @ 10:29 am
  2. Oh, a wordpress bug striked in my post above. Wordpress always removes “id equals to” code from comments. The first line should read

    $ c o d e I d = ' b a n d s ';

    Lennart — 02/15/2004 @ 10:34 am
  3. Interesting. I should look into their version. However, your hack would require a new application to be installed. I guess I am trying to do this inside wordpress. Though I am sure there are lots of lessons to be learnt from cache_Lite!
    Thanks for the suggestion!

    Mark — 02/15/2004 @ 10:44 am
  4. hey, is your cache plugin available?

    till (1 comments.) — 06/4/2005 @ 12:21 pm

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

(required)

(required, will not be published)


S2