← All changes
|
includes/modules/ObjectCache/ObjectCacheModule.php
+38
-23
1.3.6
→
1.3.7
View file →
| @@ -30,9 +30,10 @@ | ||
| 30 | 30 | public function ui_metadata(): array { |
| 31 | 31 | return array( |
| 32 | 32 | 'label' => __( 'Object Cache', 'xspeed' ), |
| 33 | 33 | 'icon' => 'Server', |
| 34 | - 'description' => __( 'Configure a persistent object cache (Redis / Memcached) and generate a paste-ready wp-config.php snippet.', 'xspeed' ), | |
| 34 | + 'description' => __( 'Stores database query results in Redis or Memcached so pages build faster.', 'xspeed' ), | |
| 35 | + 'group' => 'cache', | |
| 35 | 36 | 'custom_panel' => 'ObjectCachePanel', |
| 36 | 37 | ); |
| 37 | 38 | } |
| 38 | 39 | |
| @@ -57,17 +58,18 @@ | ||
| 57 | 58 | 'option_labels' => array( |
| 58 | 59 | 'redis' => 'Redis', |
| 59 | 60 | 'memcached' => 'Memcached', |
| 60 | 61 | ), |
| 61 | - 'label' => __( 'Backend', 'xspeed' ), | |
| 62 | - 'description' => __( 'Which cache server you intend to use. Affects the generated wp-config snippet.', 'xspeed' ), | |
| 62 | + 'label' => __( 'Cache server', 'xspeed' ), | |
| 63 | + 'description' => __( 'The cache server your host provides. Ask your host if you are not sure.', 'xspeed' ), | |
| 63 | 64 | ), |
| 64 | 65 | 'redis_host' => array( |
| 65 | 66 | 'type' => 'string', |
| 66 | 67 | 'default' => '127.0.0.1', |
| 67 | 68 | 'constants' => array( 'XSPEED_OC_HOST', 'WP_REDIS_HOST' ), |
| 68 | - 'label' => __( 'Redis Host', 'xspeed' ), | |
| 69 | - 'description' => __( 'Hostname or IP of the Redis server. Use 127.0.0.1 for a local socket on the same machine as PHP.', 'xspeed' ), | |
| 69 | + 'label' => __( 'Redis host', 'xspeed' ), | |
| 70 | + 'description' => __( 'Address of the Redis server. Use 127.0.0.1 when Redis runs on the same server as your site.', 'xspeed' ), | |
| 71 | + 'dependsOn' => array( 'field' => 'backend', 'value' => 'redis' ), | |
| 70 | 72 | ), |
| 71 | 73 | 'redis_port' => array( |
| 72 | 74 | 'type' => 'int', |
| 73 | 75 | 'default' => 6379, |
| @@ -73,10 +75,12 @@ | ||
| 73 | 75 | 'default' => 6379, |
| 74 | 76 | 'min' => 1, |
| 75 | 77 | 'max' => 65535, |
| 76 | 78 | 'constants' => array( 'XSPEED_OC_PORT', 'WP_REDIS_PORT' ), |
| 77 | - 'label' => __( 'Redis Port', 'xspeed' ), | |
| 78 | - 'description' => __( 'Default Redis port is 6379.', 'xspeed' ), | |
| 79 | + 'label' => __( 'Redis port', 'xspeed' ), | |
| 80 | + 'description' => __( 'The default Redis port is 6379.', 'xspeed' ), | |
| 81 | + 'advanced' => true, | |
| 82 | + 'dependsOn' => array( 'field' => 'backend', 'value' => 'redis' ), | |
| 79 | 83 | ), |
| 80 | 84 | 'redis_user' => array( |
| 81 | 85 | 'type' => 'string', |
| 82 | 86 | 'default' => '', |
| @@ -86,10 +90,11 @@ | ||
| 86 | 90 | // as a plain string it is a password, never a username. |
| 87 | 91 | 'constants' => array( 'XSPEED_OC_USER', 'WP_REDIS_USER', 'WP_REDIS_PASSWORD' ), |
| 88 | 92 | 'constants_pair_only' => array( 'WP_REDIS_PASSWORD' ), |
| 89 | 93 | 'constant_pair' => 'user', |
| 90 | - 'label' => __( 'Redis User', 'xspeed' ), | |
| 91 | - 'description' => __( 'Optional. Set this only if your host provisioned a dedicated Redis ACL user (Redis 6+) — e.g. some managed hosts issue a Redis User alongside the password. Leave blank to authenticate as the default user (legacy password-only Redis).', 'xspeed' ), | |
| 94 | + 'label' => __( 'Redis username', 'xspeed' ), | |
| 95 | + 'description' => __( 'Only needed if your host gave you a Redis username along with the password. Leave blank otherwise.', 'xspeed' ), | |
| 96 | + 'dependsOn' => array( 'field' => 'backend', 'value' => 'redis' ), | |
| 92 | 97 | ), |
| 93 | 98 | 'redis_password' => array( |
| 94 | 99 | 'type' => 'secret', |
| 95 | 100 | 'default' => '', |
| @@ -94,10 +99,11 @@ | ||
| 94 | 99 | 'type' => 'secret', |
| 95 | 100 | 'default' => '', |
| 96 | 101 | 'constants' => array( 'XSPEED_OC_PASSWORD', 'WP_REDIS_PASSWORD' ), |
| 97 | 102 | 'constant_pair' => 'password', |
| 98 | - 'label' => __( 'Redis Password', 'xspeed' ), | |
| 99 | - 'description' => __( 'Leave blank if your Redis server runs without auth.', 'xspeed' ), | |
| 103 | + 'label' => __( 'Redis password', 'xspeed' ), | |
| 104 | + 'description' => __( 'Leave blank if your Redis server has no password.', 'xspeed' ), | |
| 105 | + 'dependsOn' => array( 'field' => 'backend', 'value' => 'redis' ), | |
| 100 | 106 | ), |
| 101 | 107 | 'redis_database' => array( |
| 102 | 108 | 'type' => 'int', |
| 103 | 109 | 'default' => 0, |
| @@ -103,10 +109,12 @@ | ||
| 103 | 109 | 'default' => 0, |
| 104 | 110 | 'min' => 0, |
| 105 | 111 | 'max' => 15, |
| 106 | 112 | 'constants' => array( 'XSPEED_OC_DATABASE', 'WP_REDIS_DATABASE' ), |
| 107 | - 'label' => __( 'Redis Database', 'xspeed' ), | |
| 108 | - 'description' => __( 'Redis logical DB number (0-15). Use a dedicated DB per site if Redis is shared.', 'xspeed' ), | |
| 113 | + 'label' => __( 'Redis database', 'xspeed' ), | |
| 114 | + 'description' => __( 'Database number, 0 to 15. If several sites share one Redis server, give each site its own number.', 'xspeed' ), | |
| 115 | + 'advanced' => true, | |
| 116 | + 'dependsOn' => array( 'field' => 'backend', 'value' => 'redis' ), | |
| 109 | 117 | ), |
| 110 | 118 | 'memcached_host' => array( |
| 111 | 119 | 'type' => 'string', |
| 112 | 120 | 'default' => '127.0.0.1', |
| @@ -131,10 +139,11 @@ | ||
| 131 | 139 | 'var' => 'memcached_servers', |
| 132 | 140 | 'reader' => array( '\\XSpeed\\Object_Cache', 'first_memcached_server' ), |
| 133 | 141 | 'slot' => 0, |
| 134 | 142 | ), |
| 135 | - 'label' => __( 'Memcached Host', 'xspeed' ), | |
| 136 | - 'description' => __( 'Used when Backend = Memcached.', 'xspeed' ), | |
| 143 | + 'label' => __( 'Memcached host', 'xspeed' ), | |
| 144 | + 'description' => __( 'Address of the Memcached server. Use 127.0.0.1 when it runs on the same server as your site.', 'xspeed' ), | |
| 145 | + 'dependsOn' => array( 'field' => 'backend', 'value' => 'memcached' ), | |
| 137 | 146 | ), |
| 138 | 147 | 'memcached_port' => array( |
| 139 | 148 | 'type' => 'int', |
| 140 | 149 | 'default' => 11211, |
| @@ -153,10 +162,12 @@ | ||
| 153 | 162 | 'var' => 'memcached_servers', |
| 154 | 163 | 'reader' => array( '\\XSpeed\\Object_Cache', 'first_memcached_server' ), |
| 155 | 164 | 'slot' => 1, |
| 156 | 165 | ), |
| 157 | - 'label' => __( 'Memcached Port', 'xspeed' ), | |
| 158 | - 'description' => __( 'Default Memcached port is 11211.', 'xspeed' ), | |
| 166 | + 'label' => __( 'Memcached port', 'xspeed' ), | |
| 167 | + 'description' => __( 'The default Memcached port is 11211.', 'xspeed' ), | |
| 168 | + 'advanced' => true, | |
| 169 | + 'dependsOn' => array( 'field' => 'backend', 'value' => 'memcached' ), | |
| 159 | 170 | ), |
| 160 | 171 | 'key_prefix' => array( |
| 161 | 172 | 'type' => 'string', |
| 162 | 173 | 'default' => '', |
| @@ -180,10 +191,12 @@ | ||
| 180 | 191 | // unlock the field. With no salt of our own the field stays |
| 181 | 192 | // blank and editable; the drop-in still honours a defined |
| 182 | 193 | // WP_CACHE_KEY_SALT as its last-resort salt at runtime. |
| 183 | 194 | 'constants' => array( 'XSPEED_OC_SALT', 'WP_REDIS_PREFIX' ), |
| 184 | - 'label' => __( 'Cache Key Prefix', 'xspeed' ), | |
| 185 | - 'description' => __( 'Unique salt for this site\'s cache keys. Leave blank and xSpeed derives one automatically for this install, so sites sharing a Redis/Memcached server never collide. On ACL/namespaced Redis (e.g. xCloud), set this to the host\'s "Redis Object Cache Key" — otherwise cache writes are denied (NOPERM) and nothing persists.', 'xspeed' ), | |
| 195 | + 'label' => __( 'Cache key prefix', 'xspeed' ), | |
| 196 | + 'description' => __( 'Leave blank and xSpeed picks a unique prefix for this site. Some managed Redis hosts, such as xCloud, give you a key to paste here, or nothing gets saved.', 'xspeed' ), | |
| 197 | + // Not advanced: on ACL hosts it is required, and the write-denied | |
| 198 | + // notice (Object_Cache::write_denied_message) sends users here. | |
| 186 | 199 | ), |
| 187 | 200 | 'connection_timeout' => array( |
| 188 | 201 | 'type' => 'int', |
| 189 | 202 | 'default' => 1, |
| @@ -189,18 +202,20 @@ | ||
| 189 | 202 | 'default' => 1, |
| 190 | 203 | 'min' => 0, |
| 191 | 204 | 'max' => 60, |
| 192 | 205 | 'constants' => array( 'XSPEED_OC_TIMEOUT', 'WP_REDIS_TIMEOUT' ), |
| 193 | - 'label' => __( 'Connection Timeout (seconds)', 'xspeed' ), | |
| 206 | + 'label' => __( 'Connection timeout (seconds)', 'xspeed' ), | |
| 194 | 207 | 'unit' => 'seconds', |
| 195 | - 'description' => __( 'How long to wait for a connection. Keep low (1-2s) so a misconfigured cache never stalls the page.', 'xspeed' ), | |
| 208 | + 'description' => __( 'How long to wait for the cache server. Keep it at 1 or 2 seconds so a broken cache server never holds up a page.', 'xspeed' ), | |
| 209 | + 'advanced' => true, | |
| 196 | 210 | ), |
| 197 | 211 | 'persistent' => array( |
| 198 | 212 | 'type' => 'bool', |
| 199 | 213 | 'default' => true, |
| 200 | 214 | 'constants' => array( 'XSPEED_OC_PERSISTENT', 'WP_REDIS_PERSISTENT' ), |
| 201 | - 'label' => __( 'Persistent Connections', 'xspeed' ), | |
| 202 | - 'description' => __( 'Reuse the connection across PHP requests when supported. Generally a win unless the cache server complains about idle connections.', 'xspeed' ), | |
| 215 | + 'label' => __( 'Persistent connections', 'xspeed' ), | |
| 216 | + 'description' => __( 'Keep the connection open between page loads. Turn off only if your cache server reports too many idle connections.', 'xspeed' ), | |
| 217 | + 'advanced' => true, | |
| 203 | 218 | ), |
| 204 | 219 | ); |
| 205 | 220 | } |
| 206 | 221 | |