The WordPress gettext implementation is very slow. It uses objects that cannot be cached into memory without reinstanting them.
MOCache generate a PHP hashtable (array) with all seen translations. If external object cache (Redis, Memcache, Memcached, etc.) is active they are saved in transients. If not, they are saved in temp files (OPcache can grab the values from memory).
Moreover, MOCache does lazyloading for strings that are only encountered in output. It does not load all translations for a domain if it is not necessary.
Drop mo-cache.php
into wp-content/mu-plugins
and enjoy the added speed :)
The more plugins you have the better the performance gains.
Let us know how it goes or report an issue at Issues panel.
- Follow @creapuntome on Twitter
- Donate https://www.paypal.me/creapuntome/
- Anyone is welcome to contribute to the plugin.
- Please merge (squash) all your changes into a single commit before you open a pull request.
2021 Creame.
MOCache is heavily inspired and is a mix with the best of:
- "WordPress Translation Cache" by Pressjitsu, Inc.
- pro: create optimized hashtables with only required strings.
- con: only save temp files.
- "A faster load_textdomain" by Per Søderlind
- pro: save .mo files in fast WordPress transients.
- con: save full .mo files.
GPLv3
- Initial release