Recent Topics

1 Jun 21, 2005 14:12    

This post has been intentionnally deleted by its author.


  • [url=]Simple Cache Hack[/url][/list:u]

  • for more information about the Simple Cache Hack.

    2 Jun 22, 2005 11:22

    [Intentionnally deleted]

    3 Jun 29, 2005 16:55

    ralphy wrote:

    The following code manages a simple cache system for b2evolution blogs.

    Other behaviors

    If the cache_on variable is set (including on the URL itself), the cache for that URL is used if it exists, whenever it's been created.

    If the cache_off variable is set (including on the URL itself), the cache is not used and the page is created from scratch.


    Since each URL produces its own cache file, the cache folder should be cleaned up on a regular basis, since there is an unlimited amount of possible URLs (since you can use search and add anything to the URL). That might be a security issue (flood attack)...

    Since each page is loaded by the server that is not you, your login state is probably wrong. Remember the following URLs (relative to your blog's directories; add these pages to your favorites before applying the hack): htsrv/login.php to login and admin/ to admin.


    The cache updates itself on its age. It does not take into account any changes in the page. In other words, posting a comment does not update the cache page. Be careful when using this (very) simple cache. I use it myself on a few pages of my blog only.

    Blog A, cache_off: 1,611 ms
    Blog A, cache_on: 347 ms

    This simple cache system should reduce your CPU usage a lot, especially on popular blogs/pages.


    I am SUPER GLAD to read your post and find out about your good work on this issue, which sounds it could be a major help for my blog, which I am tired of migrating every 2 or 3 weeks when the hosting service complains that the blog is grabbing an unacceptable portion of CPU Usage on a shared server.

    I have to confess I could not understand most of what you posted, I am only a user, not a programmer or coder, etc.

    Could you give me a couple of pointers on how to use the cache, for instance you say it does not update itself after a comment, what do I need to do to update the cache?

    And most important, what do you mean "be care careful when using it". You say you use it on certain pages only, do you think it would work for my entire blog which gets 80,000 page views and 15,000 unique visitors a day?

    4 Jun 29, 2005 17:41

    I have to leave for a week. I'm going to explain the "right" usage of this hack in a more "user friendly" way.

    The cache won't break anything in your blog. However, if you just implement it as is, people won't be able to see the comments they've just posted for 1 minute with the values given above.

    I've tested a slightly different/newer/better version of the cache system described here on my blog and it appears to work pretty fine with about 86% of my blogs pages successfully cached.

    There is no reason this hack would not work on your blog. Mine is "a bit" less popular (about 1,000 unique visitors and 2-5,000 pages a day), but if two people see the same page twice, this cache appears to be an interesting solution (since I don't know any other).

    I'm going to post more information once back next week.

    Have a look here: [url=]Turck MMCache for PHP[/url]. It's a PHP compiler (and not a "real" cache). However, I haven't tested it yet.

    5 Jul 01, 2005 05:54

    Thank you for your answer... I tried implementing this, but my first hurdle is that in my installation there is no such file as "hacks.php" in the conf directory. I did create a _hacks.php file and placed it in the conf directoy, and also created a tmp directory (where exactly should I place this directory? I have in the the public folder). Then I did copy the code in my skin file (which I assume is main.php, right?). Also, where exactly should I place this code, you say "at the top" so I put it as the very first thing in my _main.php file for my skin.

    As you no doubt predicted after reading my installation attempt above, the cache is not working... can you please tell me in more detail where things go, what permissions are necessary (you say the tmp directory need to be accessed by the server, what are the permissions there?).

    Well, I'll wait until your return for instructions... the good thing is that after making the mods as you suggested above, my blog still works... even though nothing is being written to the tmp directory, so I assume the cache is not working.

    Form is loading...