Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

batcache

A memcached HTML page cache for WordPress.

Subscribe to updates I use batcache


Statistics on batcache

Number of watchers on Github 194
Number of open issues 14
Average time to close an issue 12 months
Main language PHP
Average time to merge a PR about 1 month
Open pull requests 11+
Closed pull requests 22+
Last commit almost 2 years ago
Repo Created over 10 years ago
Repo Last Updated almost 2 years ago
Size 35 KB
Homepage http://wordpress....
Organization / Authorautomattic
Contributors13
Page Updated
Do you use batcache? Leave a review!
View open issues (14)
View batcache activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating batcache for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

=== Batcache === Contributors: automattic, andy, orensol, markjaquith, vnsavage, batmoo, yoavf Tags: cache, memcache, memcached, speed, performance, load, server Requires at least: 3.2 Tested up to: 3.5 Stable tag: 1.2

Batcache uses Memcached to store and serve rendered pages.

== Description ==

Batcache uses Memcached to store and serve rendered pages. It can also optionally cache redirects. It's not as fast as Donncha's WP-Super-Cache but it can be used where file-based caching is not practical or not desired. For instance, any site that is run on more than one server should use Batcache because it allows all servers to use the same storage.

Development testing showed a 40x reduction in page generation times: pages generated in 200ms were served from the cache in 5ms. Traffic simulations with Siege demonstrate that WordPress can handle up to twenty times more traffic with Batcache installed.

Batcache is aimed at preventing a flood of traffic from breaking your site. It does this by serving old pages to new users. This reduces the demand on the web server CPU and the database. It also means some people may see a page that is a few minutes old. However this only applies to people who have not interacted with your web site before. Once they have logged in or left a comment they will always get fresh pages.

Possible future features:

  • Comments, edits, and new posts will trigger cache regeneration
  • Online installation assistance
  • Configuration page
  • Stats

== Installation ==

  1. Get the Memcached backend working. See below.

  2. Upload advanced-cache.php to the /wp-content/ directory

  3. Add this line the top of wp-config.php to activate Batcache:

define('WP_CACHE', true);

  1. Test by reloading a page in your browser several times and then viewing the source. Just above the </head> closing tag you should see some Batcache stats.

  2. Tweak the options near the top of advanced-cache.php

  3. Optional Upload batcache.php to the /wp-content/plugins/ directory.

= Memcached backend =

  1. Install memcached on at least one server. Note the connection info. The default is 127.0.0.1:11211.

  2. Install the PECL memcached extension and Ryan's Memcached backend 2.0. Use the 1.0 branch if you don't have or can't install the PECL extension.

== Frequently Asked Questions ==

= Should I use this? =

Batcache can be used anywhere Memcached is available. WP-Super-Cache is preferred for most blogs. If you have more than one web server, try Batcache.

= Why was this written? =

Batcache was written to help WordPress.com cope with the massive and prolonged traffic spike on Gizmodo's live blog during Apple events. Live blogs were famous for failing under the load of traffic. Gizmodo's live blog stays up because of Batcache.

Actually all of WordPress.com stays up during Apple events because of Batcache. The traffic is twice the average during Apple events. But the web servers and databases barely feel the difference.

= What does it have to do with bats? =

Batcache was named supercache when it was written. (It's still called that on WordPress.com.) A few months later, while supercache was still private, Donncha released the WP-Super-Cache plugin. It wouldn't be fun to dispute the name or create confusion for users so a name change seemed best. The move from Super to Bat was inspired by comic book heroes. It has nothing to do with the fact that the author's city is home to the world's largest urban bat colony.

== Changelog ==

= trunk =

  • Add REQUEST_METHOD to the cache keys. Prevents GET requests receiving bodyless HEAD responses. This change invalidates the entire cache at upgrade time.

= 1.1 =

  • Many bugfixes and updates from trunk
batcache open issues Ask a question     (View All Issues)
  • over 3 years nginx Headers Not Getting Cached
  • over 3 years Exempt PUT, PURGE, and DELETE requests
  • over 3 years normalize versions and update changelog
  • almost 4 years Cache flush rules
  • about 4 years set $seconds = 0 in the batcache class and could not find 'served from batcache in xxx seconds'
batcache open pull requests (View All Pulls)
  • Add support for stale-if-error Cache-Control directive
  • Stale cache
  • Introduce unit tests via the WordPress Core test framework
  • Vary headers
  • Use __construct
  • Only cache GET or HEAD. Closes #67.
  • Allows nginx headers to be cached. Fixes #70.
  • Set page gen time to request start if possible
  • Don't use get_post() when cleaning post cache, use already passed $post object
  • Enable specific script filenames to be excluded from Batcache
  • Use negative lookahead to allow openssl_* functions
batcache list of languages used
Other projects in PHP