Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cachewerk/relay-wp-l10n
Use Relay to store WordPress translation in PHP runtime memory.
https://github.com/cachewerk/relay-wp-l10n
redis wordpress-plugin
Last synced: 4 days ago
JSON representation
Use Relay to store WordPress translation in PHP runtime memory.
- Host: GitHub
- URL: https://github.com/cachewerk/relay-wp-l10n
- Owner: cachewerk
- License: mit
- Created: 2023-09-01T17:30:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-05T23:16:04.000Z (about 1 year ago)
- Last Synced: 2024-12-21T12:36:40.386Z (18 days ago)
- Topics: redis, wordpress-plugin
- Language: PHP
- Homepage: https://relay.so
- Size: 56.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WordPress Localization cache using Relay
Use [Relay](https://relay.so) to store WordPress translation in PHP runtime memory.
## Installation
Install as plugin, or Must-Use plugin.
### Composer installation
To install the plugin using Composer, add the repository to your `composer.json`:
```json
{
"repositories": [
{ "type": "vcs", "url": "[email protected]:cachewerk/relay-wp-l10n.git" }
],
}
```Then simply run:
```bash
composer require cachewerk/relay-wp-l10n
```## Caveats
1. If `RELAY_L10N_CONFIG` is not set, the plugin will do nothing
2. Translations are invalidated using `FLUSHDB`, be sure to set a dedicated `database` for translations so it won't flush the regular object cache as well
3. Relay's `Table` class currently caches data on a per-worker basis, so the cache needs to warm up for all workers in a FPM pool## Configuration
Add the `RELAY_L10N_CONFIG` constant to your `wp-config.php`.
```php
define('RELAY_L10N_CONFIG', [
'host' => $_SERVER['CACHE_HOST'],
'port' => $_SERVER['CACHE_PORT'],
'database' => $_SERVER['CACHE_DB'] + 1,
'password' => $_SERVER['CACHE_PASSWORD'],
] );
```### Default configuration
| Option | Default | Description |
| ---------------- | ----------- | ----------- |
| `scheme` | `tcp` | |
| `host` | `127.0.0.1` | |
| `port` | `6379` | |
| `database` | `0` | |
| `username` | | |
| `password` | | |
| `prefix` | | |
| `timeout` | `0.5` | |
| `read_timeout` | `0.5` | |
| `backoff` | `smart` | Supports: `none`, `smart` |
| `retries` | `3` | |
| `retry_interval` | `20` | |
| `tls_options` | `false` | |
| `persistent` | `false` | Whether to use a persistent connection |
| `footnote` | `true` | Whether to print a HTML comment with statistics |