Simple Fragment and Object Caching using WP Transients API
Blunt Cache is a persistent fragment and object chache for those of us that cannot use full page caching.
This plugin is meant for developers and requires code changes to your theme (and/or plugins). Please be sure to read the Documentation.
Capture and cache the HTML output of any section of code. Useful for storing HTML that is expensive to generate while leaving portions of the page that do not take much time or contain dynamic portions alone.
Capture and cache any object. Run a WP_query and cache the results. Store any variable that is time consuming to generate.
Most object caching scripts I've seen that override WP_Object_Cache are all or nothing, or require you to define what not to cache, I think. Seriously, I just find them a PITA to use. I don't want to do complex configurations or coding to do something that should be really simple. This plugin will let you pick and choose what to cache persistantly without the hassle. Although this means that we can't cache the main query, so it has its downside.
Uses the WP Transients API to store cached objects and html fragments. This means that the cache data is stored in the options table in the DB and does require some queries. The small number of simple DB qureies used during the caching process should take less time.
You use the cache by using apply_filters and do_action functions instead of calling functions of the plugin or instantiating a new object for every fragment and object to be cached. This means that you do not need to worry about checking to see that functions exist before you can use them. It also means that you can deactivate the plugin without worrying about your site breaking if you do. Need to do some work on the site and test, don't want the cache to work while your doing it, just deactivate it, no files to remove.
You can set the default experation time and the experation of individual fragments and object. Set the experation time for 1 second to... well... whatever floats your boat.
You supply the unique key names for storing fragments and objects. Share the same fragments and objects in a single request or across mulitple requests, a single template file or multiple template files.
Clear the entire cache at any time by adding ?blunt-query=clear to any url on your site.
Clear individual fragments or objects from the cache.
I have not added any mechanism to detect when items are updated or need to be cleared. I assume that you'll know when you need to clear the cache or that you'll write code that can use the action to clear individual fragments or objects when this needs to be accomplished. We'll see how much use this gets. If there's a lot of people using it then I'll consider figuring out how to add something.
Clearing the cache or deactivating this plugin will remove all transient data that it has created so you don't need to worry about crap building up in you DB.
No need to install any other caching plugin to make it work, but it does require adding code to your templates and/or plugins. This is not much different than the transient api.
Visit the GitHub repo for this plugin.
Safe to add to themes and plugins, does its own checking to see if another instance of Blunt Cache is already running.
Requires: 3.5 or higher
Compatible up to: 4.7.1
Last Updated: 4 weeks ago
Active Installs: 30+
Got something to say? Need help?