The fastest cache engine for WordPress, that produces cache of database queries with easy configuration. Compatible with WordPress 3.4
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. Now compatible with WordPress 3.1.
This plugin is based on DB Cache Reloaded by sirzooro. I patch it so it have WordPress 3.4 compatibility.
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 Reloaded 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 possible.
This plugin is a fork of a DB Cache plugin. Because his author did not updated its plugin to WordPress 2.8, I finally (after almost three months since release of WP 2.8) took his plugin and updated it so now it works with newest WordPress version. Additionally I fixed few bugs, cleaned up the code and make it more secure.
This plugin was tested with WordPress 2.8 and never. It may work with earlier versions too – I have not tested. If you perform such tests, let me know of the results.
If you are using WordPress 2.9, please use DB Cache Reloaded version 2.0 or never – versions 1.x are not compatible with WordPress 2.9.
If you are using WordPress 3.0, please use DB Cache Reloaded version 2.1 or never – earlier versions are not compatible with WordPress 3.0.
For Web Developer:
If you are a web developer fork me on [Github] (https://github.com/ivankristianto/DB-Cache-Reloaded-Fix)
Available translations:
Other interesting stuff:
db-cache-reloaded-fix
directory to the /wp-content/plugins/
directorydb-cache-reloaded-fix
directory to the /wp-content/plugins/
directoryCheck 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.
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.
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.
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.
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.
Make sure wp-content is writeable by the web server. If not you’ll need to chmod wp-content folder for writing.
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.
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.
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.
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.
By default DB Cache Reloaded saves cached queries in wp-content/db-cache-reloaded-fix/cache
. 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.
RAND()
;DBCR_CACHE_DIR
define to change default cache directory;DBCR_SAVEQUERIES
define to enable extended query logging (as compared to default SAVEQUERIES
support)