WordPress.org

Ready to get started?Download WordPress

Plugin Directory

!This plugin hasn't been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

DB Cache Reloaded

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

How do I know my blog is being cached?

Check your cache directory wp-content/tmp/ for cache files. Check the load statistics in footer. Also you can set DBCR_DEBUG to true in db-cache-reloaded.php file to display as hidden comments on your html page, what queries were loaded from cache and what from mysql.

You can also define DBCR_SAVEQUERIES in wp-config.php file - it works similarly as defining SAVEQUERIES, but DB Cache Reloaded adds one extra field to the $wpdb->queries array - boolean value indicating if query was executed directly (false) or loaded from cache (true). Of course you can also use some extra code (e.g. some plugin) do display this data.

What does this plugin do?

This plugin decreases count of queries to DB, which means that CPU load of your web-server decreases and your blog can serve much more visitors in one moment.

What is page generation time?

It is time from request to server (start of generation) and the generated page sent (end of generation). This time depends on server parameters: CPU speed, RAM size and the server load (how much requests it operates at the moment, popularity of sites hosted on the server) and of course it depends on how much program code it needs to operate for page generation.

Let set the fourth parameter as constant (we can't change the program code). So we have only 3: CPU, RAM and popularity.

If you have a powerful server (costs more) it means that will be as low as possible and it can serve for example 100 visitors in one moment without slowing down. And another server (low cost) with less CPU speed and RAM size, which can operate for example 10 visitors in one moment. So if the popularity of your site grows it is needed more time to generate the page. That's why you need to use any caching plugins to decrease the generation time.

How can I ensure of reducing server usage?

You can show usage statistics with your custom template in your footer.

Checking count of queries, ensure that other cache plugins are disabled, because you can see cached number.

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 Reloaded, I think you'll find the number of queries reducing a lot.

Why is DB Cache Reloaded better than WP Super Cache?

This plugin is based on a fundamentally different principle of caching queries to database instead of full pages, which optimises 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.

Dmitry Svarytsevych analysed server load graphs of his sites and he can say that the peaks of server load are caused of search engines bots indexing your site (they load much pages practically in one moment). He has tried WP Super Cache to decrease the server loads but it was no help from it. Simply saying WP Super Cache saves any loaded page and much of these pages that are opened only once by bots. His original plugin (DB Cache) roughly saves parts of web-page (configuration, widgets, comments, content) separately, which means that once configuration is cached it will be loaded on every page.

Here is the Google translation of Dmitry Svarytsevych's article on it.

Troubleshooting

Make sure wp-content is writeable by the web server. If not you'll need to chmod wp-content folder for writing.

How do I uninstall DB Cache Reloaded?

  1. Disable it at Settings->DB Cache Reloaded page. The plugin will automatically delete all cache files. If something went wrong - delete /wp-content/db.php, /wp-content/db-config.ini and /wp-content/tmp folder manually. When wp-content/db.php file exists, WordPress will use our optimised DB class instead of its own.
  2. Deactivate it at plugins page.

Why plugin shows -1 as number of cached queries?

By default DB Cache Reloaded shows number of cached queries in hidden HTML comment in page footer. When you see -1 as a cached queries count, this means that caching is not active. Please make sure that you have enabled caching on settings page (DB Cache Reloaded also shows message in admin backend when caching is not enabled). If caching is enabled and you still see -1, this is a result of conflict with other plugin, which wants to replace default wpdb class with its own too. You have to disable plugins one by one until you find one which causes this conflict. If you have added custom code to your wp-config.php (or other file) in order to install plugin, please remove (or comment out) it too. When you find conflicting plugin, please notify its author about this problem.

You can also try to enable Wrapper Mode - it may help.

Why plugin shows 0 as number of cached queries?

Please check if you have enabled caching. If yes, this may indicate some problems with your plugins - check previous question (Why plugin shows -1 as number of cached queries?) for more details.

What is the Wrapper Mode?

When DB Cache Reloaded works in Wrapper Mode, it uses different method to load DB Module. By default plugin assumes that WordPress will be able to load wp-content/db.php. However sometimes other plugin may load wp-includes/wp-db.php file directly, or replace value of $wpdb variable. This usually does not allow DB Cache Reloaded to work. When you enable Wrapper Mode, DB Cache Reloaded will load a bit different DB Module, which adds caching and works as a proxy for DB Module loaded by other plugin. Depending on your plugin, everything may work smoothly, or there may be some issues.

Wrapper is also a bit slower then normal method, and does not cache all queries (usually one, but some plugins may increase this number). It also requires at least PHP 5 to work.

I am a plugin developer. How can I make my plugin compatible with DB Cache Reloaded?

DB Cache Reloaded uses default WordPress mechanism to load custom version of wpdb class - it creates custom wp-content/db.php file. WordPress checks if this file exists, and loads it instead of wp-includes/wp-db.php.

When your plugin includes this class using custom code added to wp-config.php (or any other file), please use require_wp_db() to do this, or use similar code to this function body.

When you need to modify wpdb class (e.g. by adding or replacing methods), consider deriving your class from the default one (using the extends keyword). Another option is to use aggregation - save value of $wpdb variable, create object of your class and assign to $wpdb. Your class should call methods and access member variables of this saved object, in order to keeps its functionality. Your class should also implement magic methods __get, __set, __isset, __unset and __call.

Note: when you use derivation, make sure you create object of your class very early, before queries are done. Otherwise number of queries shown in stats will be incorrect.

How to move default cache directory elsewhere?

By default DB Cache Reloaded saves cached queries in wp-content/tmp dir (or another, if you changed value of WP_CONTENT_DIR constant). If you want to change this location, please define DBCR_CACHE_DIR constant in your wp-config.php file - it should point to existing directory. DB Cache Reloaded will use it instead of default location.

Requires: 2.8 or higher
Compatible up to: 3.0.9
Last Updated: 2011-10-24
Downloads: 77,999

Ratings

4 stars
4.2 out of 5 stars

Support

0 of 1 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1
100,1,1 100,1,1 100,4,4 75,8,6
71,7,5 50,2,1 100,7,7 75,4,3
100,1,1 100,1,1 100,2,2 83,6,5
57,7,4
79,14,11 100,4,4
6,17,1 100,9,9
75,12,9
100,2,2
100,6,6
2,64,1
0,5,0
0,2,0
20,5,1
50,2,1
33,3,1
25,4,1