├── mo-cache.php ├── readme.txt └── screenshot-1.png /mo-cache.php: -------------------------------------------------------------------------------- 1 | entries = $cache['entries']; 41 | $mo->set_headers( $cache['headers'] ); 42 | } else { 43 | if ( !$mo->import_from_file( $mofile ) ) return false; 44 | $cache = array( 45 | 'entries' => $mo->entries, 46 | 'headers' => $mo->headers, 47 | ); 48 | wp_cache_set( $key, $cache, self::GROUP ); 49 | } 50 | 51 | if ( isset( $l10n[$domain] ) ) 52 | $mo->merge_with( $l10n[$domain] ); 53 | $l10n[$domain] = &$mo; 54 | return true; 55 | } 56 | } 57 | 58 | MOCache::setup(); 59 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === MO Cache === 2 | Contributors: m4i 3 | Tags: cache, caching, performance, benchmark, benchmarking, i18n, internationalization, l10n, localization, language, languages, translation, translate 4 | Requires at least: 3.2 5 | Tested up to: 3.4 6 | Stable tag: 2.0 7 | 8 | Improving the site performance by caching translation files using the WordPress standard cache mechanism. 9 | 10 | 11 | == Description == 12 | 13 | The MO Cache provides simple and fast caching of the translation MO files using the [WP Object Cache](http://codex.wordpress.org/Class_Reference/WP_Object_Cache) mechanism. 14 | This plugin is necessary to be used [persistent caching plugin](http://codex.wordpress.org/Class_Reference/WP_Object_Cache#Persistent_Cache_Plugins), otherwise you can not benefit from this plugin. 15 | 16 | For localized WordPress, which was newly installed, the loading time of translation files accounts for 70% of the entire processing time. 17 | You can make this process 3 times faster by just installing this plugin. 18 | 19 | [Description in Japanese (日本語での紹介記事)](http://m4i.hatenablog.com/entry/2011/12/10/000407) 20 | 21 | = Features = 22 | 23 | * No configuration 24 | * Supports multiple languages 25 | * Supports plugin's translation files caching 26 | * Supports WordPress Network/Multisite installation 27 | * A simple plugin in less than 100 lines 28 | 29 | 30 | == Installation == 31 | 32 | = Quick Installation = 33 | 34 | 1. Verify that `/wp-content/object-cache.php` is installed. 35 | 1. Install the plugin; the "Plugins -> Add New" menu in the WordPress. 36 | 1. Activate the plugin. 37 | 38 | = Recommended Installation = 39 | 40 | It is recommended to install the MO Cache as a [must-use plugin](http://codex.wordpress.org/Must_Use_Plugins) because the translation files will not be cached if other plugins load translation files before the MO Cache is loaded. 41 | 42 | 1. Verify that `/wp-content/object-cache.php` is installed. 43 | 1. Create `/wp-content/mu-plugins` directory, if it not exist. 44 | 1. Upload `mo-cache.php` to the `/wp-content/mu-plugins` directory. 45 | 1. Done! No need to activate. 46 | 47 | 48 | == Frequently Asked Questions == 49 | 50 | = Does this plugin support multiple WordPress installs? = 51 | 52 | It depends on the persistent caching plugin. 53 | [APC Object Cache Backend](http://wordpress.org/extend/plugins/apc/), [W3 Total Cache](http://wordpress.org/extend/plugins/w3-total-cache/) and [WP File Cache](http://wordpress.org/extend/plugins/wp-file-cache/) support it. 54 | 55 | 56 | == Screenshots == 57 | 58 | 1. Benchmarking WordPress 3.3 ja using Xdebug profiler. 59 | 60 | 61 | == Changelog == 62 | 63 | = 2.0 = 64 | * Support WordPress 3.4 65 | 66 | = 1.2 = 67 | * No change in the code 68 | * Fix typos in readme 69 | 70 | = 1.1 = 71 | * No change in the code 72 | * Tested up to WordPress 3.3 73 | 74 | = 1.0 = 75 | * Initial release 76 | -------------------------------------------------------------------------------- /screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m4i/wordpress-mo-cache/18024d7fd0c91a53bbf018d8393b180380c9dd1f/screenshot-1.png --------------------------------------------------------------------------------