WordPress

Майстер класи WordPress

DB Cache plugin

The fastest cache engine for WordPress, that produces cache of database queries with easy configuration.

Description

This plugin caches every database query with given lifetime. It is much faster than other html caching plugins and uses less disk space for caching.

I think you’ve heard of WP-Cache or WP Super Cache, they are both top plugins for WordPress, which make your site faster and responsive. Forget about them – with DB Cache your site will work much faster and will use less disk space for cached files. Your visitors will always get actual information in sidebars and server CPU loads will be as low as posible.

See the DB Cache homepage for further information.

Installation

1. You should upload the db-cache folder to your wp-content/plugins
2. Go to your Plugins page and activate “DB Cache”
3. Now go to Settings->DB Cache and enable caching of DB queries. The plugin will create wp-content/tmp folder and db.php file for serving cached queries in wp-content folder.

That’s all! Enjoy the speed of loading pages.

Frequently Asked Questions

How do I know my blog is being cached?

Check your cache directory wp-content/tmp/ for cache files.

How can I ensure of reducing server usage?

View the source of your site page, there maybe some code like this at the foot:

<!– 00 queries. 00 seconds. –>

If not, please put these codes in your footer template:

<!– <?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds. –>

After using the DB Cache, I think you’ll find the number of ‘queries’ reducing a lot.

Why is DB Cache better than WP Super Cache?

This plugin is based on a fundamentally different principle of caching queries to database instead of full pages, which optimizes WordPress from the very beginning and uses less disk space for cache files because it saves only useful information.
It saves information separately and also caches hidden requests to database.

Troubleshooting

Make sure wp-content is writeable by the web server. If not you’ll need to chmod wp-content folder for writing and also config.ini file in plugin folder.

How do I uninstall DB Cache?

1. Disable it at Settings->DB Cache page. The plugin will automatically delete all cache files.
2. Deactivate it at plugins page.

Other Notes

Updates

Updates to the plugin will be posted here and the Ukrainian WordPress will always link to the newest version.

Thanks

I would like to thank Lviv for giving me the idea for this and RKG for support.

Download

Download DB Cache Version 0.6


409 Responses to “DB Cache plugin”

  1. Sheet Plastic %0B says:

    :~, I am very thankful to this topic because it really gives great information .-*

  2. glype proxy site says:

    We really enjoy this website. Iwish I could come here everyday\all day. Please do keep putting up more stuff!

  3. gunawan says:

    Mi sento molto robusto circa e vorrei saperne di più. Se va bene, come raggiungere la sapienza extra ampio, ti pensieri aggiungere altri articoli simili a questo con informazioni aggiuntive? Sarà estremamente utile e utile per me ei miei amici.
    Grazie per le informazioni

  4. octimotor says:

    Hi:
    I upgraded to wordpress 3.0.5 early feb2011. Are there any difficulties using the db-cache plugin with this wp version?

    - octimotor – 2011-02-11 sun.;

  5. Caren Sedlak says:

    Hello, i think that i saw you visited my site thus i came to “return the favor”.I’m trying to find things to improve my web site!I suppose its ok to use some of your ideas!!

  6. sextelefon says:

    Cant even wait for another moment, gotta tell everyone about this.

  7. Wakacje says:

    Very Interesting Blog! Thank You For Thi Information!

  8. us airways flight status says:

    I usually don’t post in Blogs but your blog forced me to, amazing work.. beautiful …

  9. Jon Daley says:

    I installed db-cache for someone today, and found that it doesn’t work with wordpress 3.1.

    I’ve updated the plugin (and erased 90% of your unnecessary code…)

    The only file that I changed was db-module.php.

    I’ll have to publish this somewhere, since this comment box likely won’t format the code very well.

    Here are the contents:

    lifetime = $config['timeout'];
    $dbc->storage = WP_CONTENT_DIR.”/tmp”;

    $dbc->config = $config;

    // Clean unused
    $dbcheck = date(‘G’)/4;
    if ($dbcheck == intval($dbcheck) && $config['lastclean'] clean();
    $config['lastclean'] = time();
    $file = fopen(WP_CONTENT_DIR.”/db-config.ini”, ‘w+’);
    if ($file) {
    fwrite($file, serialize($config));
    fclose($file);
    }
    }

    $dbc_queryid = md5($query);
    $dbc_cachable = true;

    // cache only frontside
    if (defined(‘DOING_CRON’) ||
    strpos($_SERVER['REQUEST_URI'],’wp-admin’) ||
    strpos($_SERVER['REQUEST_URI'],’wp-login’) ||
    strpos($_SERVER['REQUEST_URI'],’wp-register’) ||
    strpos($_SERVER['REQUEST_URI'],’wp-signup’) ||
    preg_match(“/\\s*(insert|delete|update|replace|alter|SET NAMES|FOUND_ROWS)/si”,$query)
    )
    {
    $dbc_cachable = false;
    }

    // for hard queries
    if (preg_match(“/\\s*(JOIN | \* |\*\,)/si”,$query))
    $dbc_cachable = true;

    // User-defined cache filters
    if ($config['filter'] && preg_match(“/\\s*(“.$config['filter'].”)/si”,$query))
    $dbc_cachable = false;

    if (strpos($query,”_options”)) $dbc->storage = WP_CONTENT_DIR.”/tmp/options”;
    elseif (strpos($query,”_links”)) $dbc->storage = WP_CONTENT_DIR.”/tmp/links”;
    elseif (strpos($query,”_terms”)) $dbc->storage = WP_CONTENT_DIR.”/tmp/terms”;
    elseif (strpos($query,”_user”)) $dbc->storage = WP_CONTENT_DIR.”/tmp/users”;
    elseif (strpos($query,”_post”)) $dbc->storage = WP_CONTENT_DIR.”/tmp/posts”;

    /*
    Debug part
    */
    if ($config['debug'] && $dbc_cachable)
    echo “\n\n\n”;
    elseif ($config['debug'] && !$dbc_cachable)
    echo “\n\n\n”;

    // not cachable, just send it off to mysql
    if(!$dbc_cachable)
    return parent::query($query);

    // we already have it in our cache, yay!
    if($dbc_cached = $dbc->load($dbc_queryid)){
    ++$this->num_cachequeries;

    $dbc_cached = unserialize($dbc_cached);
    $this->last_error = $dbc_cached['last_error'];
    $this->last_query = $dbc_cached['last_query'];
    $this->last_result = $dbc_cached['last_result'];
    $this->col_info = $dbc_cached['col_info'];
    $this->num_rows = $dbc_cached['num_rows'];

    return $this->num_rows;
    }

    // run the query, return false if there is an error
    // (ie. don’t cache the error result)
    if(parent::query($query) === false)
    return false;

    // we got a good query, save the result
    $dbc_cached['last_error'] = $this->last_error;
    $dbc_cached['last_query'] = $this->last_query;
    $dbc_cached['last_result'] = $this->last_result;
    $dbc_cached['col_info'] = $this->col_info;
    $dbc_cached['num_rows'] = $this->num_rows;
    $dbc_cached = serialize($dbc_cached);

    $dbc->save($dbc_cached, $dbc_queryid);

    return $this->num_rows;
    }
    }
    endif;

    // if we set the database object here, wordpress core
    // will use ours

    $wpdb = new mywpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);

  10. Jon Daley says:

    Here’s the link for a working version for 3.1.

    I’ve only tested it for about five minutes, so maybe I’ve missed something, but I’ll update this link if I find anything wrong with it:

    http://jon.limedaley.com/code/wordpress/db-cache/db-module.phps

  11. Jon Daley says:

    I forgot to say, mostly my code is the same as yours, but instead of rewriting all of the core code, it simply uses the core function.

    I also think you want to not use the $config["filter"] if it is blank, as that does weird things – ie. filters everything.

    There was also a typo related to this functionality “fiter” that I removed.

    I think most everything else is the same with the addition that since it is now a child class of wpdb, it works with wordpress 3.1 with the new functions that were added.

  12. Dion says:

    HELP!, Fatal error: Cannot redeclare class wpdb in /home/media/public_html/wp-content/db.php on line 54

    activated your plugin now whole website is gone! cant do anything in the backoffice, cant access back office anymore!

  13. Unownenuappip says:

    Добрый день
    Благодарствую за информацию, очень нужное дело.
    Хочу купить ссылки на данной страничке

    Ильичевск
    В центре и можно слева в сообщениях. Ну или каких-либо других интересныхрекламных мест.
    Возможно по тематике вашего проекта подойдёт для рекламы сайта
    для этого проекта могу заказать более дорогостоящие статьи и обзоры.
    Поясните, как вы работаете?
    Хочу на постоянной основе покупать у вас статьи, и др. надеюсь эти сайты подойдут для ваших посетителей.
    Я покупал рекламу на разных сайтаx всего за 2800 руб. в квартал.
    Жду вашего ответа тут, напишите вашу цену. Нужно для отчёта

  14. Grumium says:

    яю

  15. Noticias Android .NET says:

    I will try with my website of Android
    http://www.noticiasandroid.net
    Thanks so much!

  16. How to write Blogs that make money | www.eqloud.com says:

    [...] DB-cache – another caching plugin which claims your site will work much faster and will use less disk space for cached files. [...]

  17. mocne tabletki odchudzające says:

    Great site, i must check this

  18. 20+ Tips Lengkap Optimasi WordPress says:

    [...] versi HTML statis dari halaman blog, mengurangi kebutuhan eksekusi script PHP dan database.1.3. DB CacheMelakukan proses caching pada query database, bukan output HTML.1.4. BatcacheMenggunakan [...]

  19. stephanie de leng says:

    Hi,
    someone PLEASE help me? I installed this plugin and was told to enable as above. My site is ruined!!!! I cannot access anything, I cannot log in – everything is gone! Months of work down the drain

    Here is the message:
    Fatal error: Cannot redeclare class wpdb in /home7/oldfrenc/public_html/masialavanda/wp-content/db.php on line 54

  20. stephanie de leng says:

    this plugin killed my site just as above only it was line 54. I read of people having the same problem all over the net. You cannot get any answers from the developers either. DO NOT INSTALL!

  21. Cara Mempercepat Loading Blog Wordpress | Read Space! says:

    [...] Install Plugin DB Cache [...]

  22. Plugins und Widgets für Wordpress die helfen | Aktiv im Web > Wissen was Online passiert > Aktiv-im-Web.de says:

    [...] DB-Cache – Ein weiteres Plugin, das Caching Ansprüche Ihrer Website schneller verarbeitet und weniger Speicher braucht. [...]

  23. Plugins und Widgets für Wordpress | Aktiv im Web > Wissen was Online passiert > Aktiv-im-Web.de says:

    [...] DB-Cache – Ein weiteres Plugin, das Caching Ansprüche Ihrer Website schneller verarbeitet und weniger Speicher braucht. [...]

  24. Wordpress Plugins und Widgets für den Blogger-Start | Aktiv im Web > Wissen was Online passiert > Aktiv-im-Web.de says:

    [...] DB-Cache – Ein weiteres Plugin, das Caching Ansprüche Ihrer Website schneller verarbeitet und weniger Speicher braucht. [...]

  25. Top WordPress Plugins and Widgets | Webmaster Tools & Resources says:

    [...] DB-cache – another caching plugin which claims your site will work much faster and will use less disk space for cached files. [...]

Leave a Reply