Redis Cache By Xon

Redis Cache By Xon 2.18.1

No permission to download
Hi @Xon ,

I use your add-ons for ages. They are probably outdated but didn't throw me errors until I upgraded to 2.3.0. Redis Cache 2.10.10 and Standard Library 2.10.2. Now I get daily errors like this:


Code:
ErrorException: Deprecated cache provider: SV\RedisCache\Redis
src/XF/Error.php:82

Stack trace

#0 src/XF.php(262): XF\Error->logError('Deprecated cach...', false)
#1 src/XF/CacheFactory.php(145): XF::logError('Deprecated cach...')
#2 src/XF.php(649): XF\CacheFactory->XF\{closure}()
#3 src/XF/Mvc/Dispatcher.php(164): XF::triggerRunOnce(true)
#4 src/XF/Mvc/Dispatcher.php(63): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#5 src/XF/App.php(2813): XF\Mvc\Dispatcher->run()
#6 src/XF.php(802): XF\App->run()
#7 index.php(23): XF::runApp('XF\\Pub\\App')
#8 {main}

Request state

array(4) {
  ["url"] => string(15) "/members/15027/"
  ["referrer"] => bool(false)
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}

Please advise what should I do.
 
Same as what I posted above, just with redis as the provider.

That said, it turns out that it actually wasn't doing anything so it wasn't working with the stock system either unfortunately. It was logging errors that SELECT isn't available in cluster mode (even if I don't specify a database ID) it just wasn't exposing those errors

Circling back on this, I've created a new elasticache instance without the serverless option since that forces cluster mode apparently, no further issues 👍
 
  • Like
Reactions: Xon
@Xon do you think LS Cache and Redis Cache should be used at the same time?

And where can I see that Redis Cache is running? When I enter my forum in an incognito tab, everything is displayed in real time.
 
Last edited:
You mentioned have LS Cache enabled at the same time, this may be doing something strange.

This add-on has nothing todo with bb-code rendering like that.
 
You mentioned have LS Cache enabled at the same time, this may be doing something strange.

This add-on has nothing todo with bb-code rendering like that.

But when I enabled redis this happened. Anyway, after rebuilding all the datas it's solved. Thanks 🙏
 
Logged this error yesterday running XenForo v2.2.16 and Redis Cache v2.18.0:

Code:
CredisException: read error on connection to tcp://127.0.0.1:6379 src/addons/SV/RedisCache/Credis/Client.php:1391
Generated by: Unknown account Oct 11, 2024 at 12:37 AM
Stack trace
#0 src/addons/SV/RedisCache/XF/CssRenderer.php(116): Credis_Client->__call('hgetall', Array)
#1 src/XF/CssRenderer.php(106): SV\RedisCache\XF\CssRenderer->getFinalCachedOutput(Array)
#2 src/XF/Pub/View/ServiceWorker/Offline.php(25): XF\CssRenderer->render(Array)
#3 src/XF/Mvc/Renderer/AbstractRenderer.php(91): XF\Pub\View\ServiceWorker\Offline->renderHtml()
#4 src/XF/Mvc/Renderer/Html.php(47): XF\Mvc\Renderer\AbstractRenderer->renderViewObject('XF:ServiceWorke...', 'public:service_...', Array)
#5 src/XF/Mvc/Dispatcher.php(460): XF\Mvc\Renderer\Html->renderView('XF:ServiceWorke...', 'public:service_...', Array)
#6 src/XF/Mvc/Dispatcher.php(442): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#7 src/XF/Mvc/Dispatcher.php(402): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#8 src/XF/Mvc/Dispatcher.php(60): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#9 src/XF/App.php(2485): XF\Mvc\Dispatcher->run()
#10 src/XF.php(524): XF\App->run()
#11 index.php(20): XF::runApp('XF\\Pub\\App')
#12 {main}

-------------

Previous RedisException: read error on connection to tcp://127.0.0.1:6379 - src/addons/SV/RedisCache/Credis/Client.php:1370
#0 src/addons/SV/RedisCache/Credis/Client.php(1370): Redis->hGetAll('xf_xfCssCache_6...')
#1 src/addons/SV/RedisCache/XF/CssRenderer.php(116): Credis_Client->__call('hgetall', Array)
#2 src/XF/CssRenderer.php(106): SV\RedisCache\XF\CssRenderer->getFinalCachedOutput(Array)
#3 src/XF/Pub/View/ServiceWorker/Offline.php(25): XF\CssRenderer->render(Array)
#4 src/XF/Mvc/Renderer/AbstractRenderer.php(91): XF\Pub\View\ServiceWorker\Offline->renderHtml()
#5 src/XF/Mvc/Renderer/Html.php(47): XF\Mvc\Renderer\AbstractRenderer->renderViewObject('XF:ServiceWorke...', 'public:service_...', Array)
#6 src/XF/Mvc/Dispatcher.php(460): XF\Mvc\Renderer\Html->renderView('XF:ServiceWorke...', 'public:service_...', Array)
#7 src/XF/Mvc/Dispatcher.php(442): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#8 src/XF/Mvc/Dispatcher.php(402): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#9 src/XF/Mvc/Dispatcher.php(60): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#10 src/XF/App.php(2485): XF\Mvc\Dispatcher->run()
#11 src/XF.php(524): XF\App->run()
#12 index.php(20): XF::runApp('XF\\Pub\\App')
#13 {main}
 
That can happen if your redis instance is saving to disk, as how it uses fork to save state is known to cause micro-stalls which cause failed connection attempts under load.

You need to disable saving to disk via the state dump feature or the append log thing.
 
Quick question:

I have two XenForo boards on the same server (different domains and db of course), for both I'm planning to use the following config:

PHP:
$config['cache']['enabled'] = true;
$config['cache']['provider'] = 'SV\RedisCache\Redis';
$config['cache']['namespace'] = 'instanceX_';
$config['cache']['config'] = [
    'server' => 'localhost',
    'port' => 6379,
    'password' => 'password',
];

Is it enough when I configure different namespaces or would you recommend a different approach?

Thanks!
 
Different namespaces will be enough, but you can also do different redis database numbers too.

For non-large forums that should be enough. The real driver for multiple redis instances is when you need better isolation of memory usage and to use more cores since redis is single threaded.
 
This doesn't work on the latest version of XenForo unless you change SV/RedisCache/XF/Pub/Controller/Forum.php:

use XF\Finder\Thread as ThreadFinder; --> use XF\Finder\ThreadFinder as ThreadFinder;

edit: For reference, the error seems to be the same as this one https://xenforo.com/community/threads/redis-cache-eror.222414/ , although it says it is fixed, it does not appear to be for me. I redownloaded XF 2.3.4 to double check and I do not see any XF\Finder\Thread class.
 
Last edited:
This was an error back in the beta/release candidates, shouldn't be an issue with XF2.3.4

Can you try disabling add-ons except this one to attempt to determine if it is an add-on conflict?
 
What add-ons?
My Cached Permission Check add-on was heavily effected under XF2.3, and it looks like User Activity was as well. Redis View Counters and Redis Flood Check should be unaffected however, but I'ld highly recommend updating this add-on if you use any other add-on of mine with redis support.
 
@Xon Any advice (link to a guide) on how to update the REDIS server to the latest version on Almalinux 9? The PHP is on the latest.
Or, am I on the latest version?
I'm guessing that there is no update but a reinstall.
Thanks,

red2.webp

Code:
[root@server ~]# sudo dnf makecache
EA4 ( EasyApache 4 - c8 )                                                         5.7 kB/s | 2.9 kB     00:00
cPanel Addons Production Feed                                                     5.8 kB/s | 2.9 kB     00:00
cPanel Plugins project                                                            5.8 kB/s | 2.9 kB     00:00
AlmaLinux 8 - BaseOS                                                              1.7 MB/s | 3.8 kB     00:00
AlmaLinux 8 - AppStream                                                           2.8 MB/s | 4.3 kB     00:00
AlmaLinux 8 - Extras                                                              2.6 MB/s | 3.3 kB     00:00
AlmaLinux 8 - PowerTools                                                           17 kB/s | 4.2 kB     00:00
Build Factory packages for Containers                                              60 kB/s | 2.9 kB     00:00
Elasticsearch repository for 8.x packages                                          31 kB/s | 1.3 kB     00:00
Extra Packages for Enterprise Linux 8 - x86_64                                     55 kB/s |  37 kB     00:00
MySQL 8.0 Community Server                                                        109 kB/s | 2.6 kB     00:00
MySQL Connectors Community                                                        111 kB/s | 2.6 kB     00:00
MySQL Tools Community                                                             112 kB/s | 2.6 kB     00:00
Remi's Modular repository for Enterprise Linux 8 - x86_64                         6.0 kB/s | 3.5 kB     00:00
Safe Remi's RPM repository for Enterprise Linux 8 - x86_64                        5.5 kB/s | 3.0 kB     00:00
WP Toolkit for cPanel                                                              64 kB/s | 2.9 kB     00:00
WP Toolkit third parties                                                           65 kB/s | 2.9 kB     00:00
Metadata cache created.
[root@server ~]# sudo dnf install redis
Last metadata expiration check: 0:00:39 ago on Mon Dec 16 18:33:24 2024.
Package redis-5.0.3-5.module_el8.4.0+2583+b9845322.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[root@server ~]#
 
Last edited:
Back
Top Bottom