Closed gitfan2 closed 2 years ago
Hey @gitfan2
To answer your questions...
- Not sure if object caching is actually happening as redis info is displaying 0% hitrate and zero key_count, while redis debug seems to be indicating active hits. Shouldn't redis info be updated in real time?
wp redis info
doesn't update in real-time. The stats are representative of whenever you ran the WP-CLI command.
- Probably a cosmetic detail: the port number is set to null as per your installation notes, however redis info is still showing the regular port number?
If the port is null, then the connection falls back to port 6379
, because the connection always needs to happen on some port.
- Which file does your "Add cache hit / miss rate to footer when logged in" snippet go to?
Your theme's functions.php
file should be fine.
Hope this helps!
Thanks, Daniel. Could you just briefly confirm, in order to put my mind to rest, that this: wp redis debug --url=https://wp3.westlink.xyz/ array ( 'cache_hits' => 11468, means wp-redis is indeed working? And if it is, just one final query: Is there any way to exclude the wp plugins from caching? Thanks again.
means wp-redis is indeed working?
It's actually the redis_calls
that means WP Redis is working:
The cache_hits
and cache_misses
would just be the calls to the internal object cache.
In that particular redis_calls
request above, there are more set
requests than I'd expect. If you see that many calls on a regular basis, it could mean that some code is constantly re-priming the object cache and never actually using it.
Is there any way to exclude the wp plugins from caching?
Not easily. However, if a given plugin uses a consistent group name, you can have it excluded from the persistent object cache: https://github.com/pantheon-systems/wp-redis#how-do-i-disable-the-persistent-object-cache-for-a-bad-actor
Hi,
Installed wp-redis on a test site, using WP 5.8.1 multi-site.
Not sure if object caching is actually happening as redis info is displaying 0% hitrate and zero key_count, while redis debug seems to be indicating active hits. Shouldn't redis info be updated in real time?
Probably a cosmetic detail: the port number is set to null as per your installation notes, however redis info is still showing the regular port number?
Which file does your "Add cache hit / miss rate to footer when logged in" snippet go to?
Thanks. Norman
wp redis info
+-------------------+----------------------------------+ | status | connected | | used_memory | 901.14K | | uptime | 0 days | | key_count | 0 | | instantaneous_ops | 110/sec | | lifetime_hitrate | 0% | | redis_host | /home/software/.redis/redis.sock | | redis_port | 6379 |
| redis_auth | | | redis_database | 125 | +-------------------+----------------------------------+
wp-config.php
/ Added for wp-redis / $redis_server = array( 'host' => '/home/software/.redis/redis.sock', 'port' => null, 'auth' => null, 'database' => 125, // Optionally use a specific numeric Redis database. Default is 0. );
wp redis debug --url=https://wp3.westlink.xyz/blog/2021/04/27/dan-flying-solo/
array ( 'cache_hits' => 4662, 'cache_misses' => 215, 'redis_calls' => array ( 'flushdb' => 1, 'get' => 142, 'set' => 206, 'exists' => 121, 'mget' => 31, 'setex' => 8, ), )
wp redis debug --url=https://wp3.westlink.xyz/
array ( 'cache_hits' => 11468, 'cache_misses' => 214, 'redis_calls' => array ( 'flushdb' => 1, 'get' => 145, 'set' => 208, 'exists' => 120, 'mget' => 36, 'setex' => 3, ), )