wearerequired/translations-cache

Reduces file reads for translations by caching the first read via APCu.

Installs: 1 782

Dependents: 0

Suggesters: 0

Security: 0

Stars: 6

Watchers: 2

Forks: 0

Open Issues: 0

Type:wordpress-muplugin

2.0.0 2024-11-19 13:29 UTC

This package is auto-updated.

Last update: 2024-12-19 13:42:26 UTC


README

Simple WordPress must-use plugin to reduce file reads for gettext (.mo) and JavaScript (.json) translations by caching the first read via APCu.

By default the cache TTL is set to six hours without any automated cache invalidation. You can set the TRANSLATIONS_CACHE_KEY_SALT environment variable to change the key for the cache which will force the plugin to read from a fresh cache entry.

Installation

  1. Define the dropin path for wordpress-muplugin
    composer config --json --merge extra.dropin-paths '{ "wordpress/content/mu-plugins/": [ "type:wordpress-muplugin" ] }'
    
  2. Install koodimonni/composer-dropin-installer and wearerequired/translations-cache
    composer require koodimonni/composer-dropin-installer wearerequired/translations-cache
    

Example of a composer.json for a site:

{
  "name": "wearerequired/something",
  "require": {
    "koodimonni/composer-dropin-installer": "^1.0",
    "wearerequired/translations-cache": "^1.0"
  },
  "extra": {
    "dropin-paths": {
      "wordpress/content/mu-plugins/": [
        "type:wordpress-muplugin"
      ]
    }
  }
}

a required open source product - let's get in touch