Redis Cache By Xon

Redis Cache By Xon 2.17.2

No permission to download
Check the redis server's logs to see why it is restarting itself. I've found redis to be quite stable, so if it is unexpectedly stopping and restarting something else is likely wrong.
 
KeyDB is a superset of redis so it should just work, especially if you are just using a single node and not the sentinel/ha stuff
 
@Xon,

I installed redis and your add ons earlier past week, if you remember my DM. :)

loading has definitely improved. However when visiting the site for the first time, it can take a few seconds until it loads up.

Do you have any idea what causes this? I’ll send you a link in DM if you want.
 
KeyDB is a superset of redis so it should just work, especially if you are just using a single node and not the sentinel/ha stuff

I can confirm KeyDB works as a direct drop in replacement for Redis with this addon without any changes needed to the config.

One recommendation, the next time you do an update, would be to identify in Admincp stats section, for this add-on, what actual data store is being used (Redis or KeyDB).
 
  • Like
Reactions: Xon
Xon updated Redis Cache By Xon with a new update entry:

2.16.0 - Feature update

  • High avaliability config default change:
    • Change default value for retry_reads_on_primary config option to true as this guards against unexpected replication delays
  • Remove unexpected differences for XF2.2 and XF2.3 support (only tested on XF2.2)
  • When displaying redis version, include the redis varaint type.
    • Known variants are keydb & dragonflydb.
    • Dragonflydb does not appear to support IO stats at the moment...

Read the rest of this update entry...
 
I'm testing XF 2.3 and this error popped up:
Code:
ErrorException: Deprecated cache provider: SV\RedisCache\Redis
src/XF/Error.php:77

Stack trace

#0 src/XF.php(224): XF\Error->logError('Deprecated cach...', false)
#1 src/XF/CacheFactory.php(135): XF::logError('Deprecated cach...')
#2 src/XF.php(382): XF\CacheFactory->XF\{closure}()
#3 src/XF/Mvc/Dispatcher.php(158): XF::triggerRunOnce(true)
#4 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#5 src/XF/App.php(2588): XF\Mvc\Dispatcher->run()
#6 src/XF.php(532): XF\App->run()
#7 index.php(20): XF::runApp('XF\\Pub\\App')
#8 {main}

Request state

array(4) {
  ["url"] => string(1) "/"
  ["referrer"] => bool(false)
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
What's the best configuration any used in there. Config file

This is mine:
Code:
// START Redis configuration //
$config['cache']['enabled'] = true;
$config['cache']['sessions'] = true;
$config['cache']['namespace'] = 'xfredis_';

$config['cache']['provider'] = 'SV\RedisCache\Redis';
$config['cache']['config'] = array(
'database' => 0,
'server' => '127.0.0.1',
'port' => 6379,
'connect_retries' => 2,
'use_lua' => true,
'compress_data' => 6,
'read_timeout' => 1,
'timeout' => 1,
'serializer' => 'igbinary',
'persistent' => true,
);

// START CSS caching //
$config['cache']['context']['css'] = [
            'namespace' => 'sv',
            'provider' => 'SV\RedisCache\Redis',
            'config' => [
'server' => '127.0.0.1',
'database' => 1,
'port' => 6379,
            ],
        ];
// END CSS caching //

$config['pageCache']['enabled'] = true;
$config['pageCache']['recordSessionActivity'] = true;
$config['cache']['context']['page']['namespace'] = 'xfredispagecache_';
$config['cache']['context']['page']['provider'] = 'SV\RedisCache\Redis';
$config['cache']['context']['page']['config'] = array(
 'database' => 2,
 'server' => '127.0.0.1',
 'port' => 6379,
 'connect_retries' => 2,
 'use_lua' => true,
 'compress_data' => 6,
 'read_timeout' => 1,
 'timeout' => 1,
 'serializer' => 'igbinary',
        );
// END Redis configuration //

$config['pageCache']['onSetup'] = function (\XF\PageCache $pageCache) {
    $pageCache->setCacheIdGenerator(function(\XF\Http\Request $request) {
        return \SV\BrowserDetection\CacheHelper::getPageCacheId($request);
    });
};
 
I'm testing XF 2.3 and this error popped up:
Code:
ErrorException: Deprecated cache provider: SV\RedisCache\Redis
src/XF/Error.php:77

Stack trace

#0 src/XF.php(224): XF\Error->logError('Deprecated cach...', false)
#1 src/XF/CacheFactory.php(135): XF::logError('Deprecated cach...')
#2 src/XF.php(382): XF\CacheFactory->XF\{closure}()
#3 src/XF/Mvc/Dispatcher.php(158): XF::triggerRunOnce(true)
#4 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#5 src/XF/App.php(2588): XF\Mvc\Dispatcher->run()
#6 src/XF.php(532): XF\App->run()
#7 index.php(20): XF::runApp('XF\\Pub\\App')
#8 {main}

Request state

array(4) {
  ["url"] => string(1) "/"
  ["referrer"] => bool(false)
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
XF is checking a specific class instead of the interface. I'll check if this is expected behavior or if I need to update this add-on
 
Last edited:
Does Redis' announcement yesterday of no longer using a BSD open source license change XF or addon's usage of its future versions?
Appears that all commercial usage has to now be approved and licensed.

 
As far as I can tell; the described the licensing change doesn't impact XenForo customers but may impact XenForo Cloud.
 
Xon updated Redis Cache By Xon with a new update entry:

2.17.0 - XF2.3 Compatibility update

  • XF2.3 compatibility update
    • A bug in XenForo 2.3 Beta 1 (Fixed in beta 2) prevents XenForo from using this as a caching backend without manual code patching references to Adapter\AbstractAdapter to Adapter\AdapterInterface
  • Add \SV\RedisCache\Repository\Redis::get()->getRedisConnector() method, this should be used instead of \XF::app()->cache() instanceof Redis or similar.

Read the rest of this update entry...
 
Latest version of this add-on with XF 2.3 b2 results in:
Code:
Error: Call to undefined method Doctrine\Common\Cache\CacheProvider::getNamespacedId()
src/addons/SV/RedisCache/XF/CssRenderer.php:112
Generated by: Unknown account
Mar 26, 2024 at 4:48 PM

Stack trace

#0 src/XF/CssRenderer.php(115): SV\RedisCache\XF\CssRenderer->getFinalCachedOutput(Array)
#1 src/XF/CssWriter.php(60): XF\CssRenderer->render(Array)
#2 src/addons/SV/RedisCache/XF/CssWriter.php(68): XF\CssWriter->run(Array, 0, 3, '0bea92c43c4ab49...')
#3 css.php(30): SV\RedisCache\XF\CssWriter->run(Array, 0, 3, '0bea92c43c4ab49...')
#4 {main}

Request state

array(4) {
  ["url"] => string(96) "/css.php?css=public%3Aextra.less&s=0&l=3&d=1711468039&k=0bea92c43c4ab499e903ba0963cccc45795a41ff"
  ["referrer"] => string(55) "https://domain.tld/admin.php?logs/server-errors/"
  ["_GET"] => array(5) {
    ["css"] => string(17) "public:extra.less"
    ["s"] => string(1) "0"
    ["l"] => string(1) "3"
    ["d"] => string(10) "1711468039"
    ["k"] => string(40) "0bea92c43c4ab499e903ba0963cccc45795a41ff"
  }
  ["_POST"] => array(0) {
  }
}

With this add-on enabled your XF install is completely trashed :P
 
I've been getting the following error when trying to do upgrade from 2.2.15 to 2.3 beta 2 on my test server.

Just moments after the "Verifying and copying files" step the upgrade stops on a white screen with error:

An unexpected error occurred. Please try again later.

With debug mode enabled I can see the folliowing error when trying to access the site:

Code:
Fatal error: Uncaught ErrorException: [E_WARNING] include(/var/www/[redacted]/public/src/vendor/composer/../../../src/vendor-patch/Doctrine/Common/Cache/CacheProvider.php): Failed to open stream: No such file or directory in /var/www/[redacted]/public/src/vendor/composer/ClassLoader.php:576 Stack trace: #0 /var/www/[redacted]/public/src/vendor/composer/ClassLoader.php(576): XF::handlePhpError(2, '...', '...', 576) #1 /var/www/[redacted]/public/src/vendor/composer/ClassLoader.php(576): include() #2 /var/www/[redacted]/public/src/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}('...') #3 /var/www/[redacted]/public/src/addons/SV/RedisCache/DoctrineCache/CacheProvider.php(19): Composer\Autoload\ClassLoader->loadClass('...') #4 /var/www/[redacted]/public/src/vendor/composer/ClassLoader.php(576): include('...') #5 /var/www/[redacted]/public/src/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}('...') #6 /var/www/[redacted]/public/src/addons/SV/RedisCache/DoctrineCache/Redis.php(26): Composer\Autoload\ClassLoader->loadClass('...') #7 /var/www/[redacted]/public/src/vendor/composer/ClassLoader.php(576): include('...') #8 /var/www/[redacted]/public/src/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}('...') #9 [internal function]: Composer\Autoload\ClassLoader->loadClass('...') #10 /var/www/[redacted]/public/src/addons/SV/RedisCache/Redis.php(11): class_alias('...', '...') #11 /var/www/[redacted]/public/src/vendor/composer/ClassLoader.php(576): include('...') #12 /var/www/[redacted]/public/src/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}('...') #13 /var/www/[redacted]/public/src/XF/CacheFactory.php(68): Composer\Autoload\ClassLoader->loadClass('...') #14 /var/www/[redacted]/public/src/XF/CacheFactory.php(36): XF\CacheFactory->instantiate('...', Array) #15 /var/www/[redacted]/public/src/XF/App.php(709): XF\CacheFactory->create('...', Array) #16 /var/www/[redacted]/public/src/XF/Container.php(234): XF\App->XF\{closure}('', Array, Object(XF\Container)) #17 /var/www/[redacted]/public/src/XF/App.php(2661): XF\Container->create('...', '') #18 /var/www/[redacted]/public/src/XF/App.php(736): XF\App->cache('...') #19 /var/www/[redacted]/public/src/XF/Container.php(31): XF\App->XF\{closure}(Object(XF\Container)) #20 /var/www/[redacted]/public/src/XF/App.php(1931): XF\Container->offsetGet('...') #21 /var/www/[redacted]/public/src/XF/Container.php(31): XF\App->XF\{closure}(Object(XF\Container)) #22 /var/www/[redacted]/public/src/XF/App.php(1597): XF\Container->offsetGet('...') #23 /var/www/[redacted]/public/src/XF/Container.php(31): XF\App->XF\{closure}(Object(XF\Container)) #24 /var/www/[redacted]/public/src/XF/App.php(2980): XF\Container->offsetGet('...') #25 /var/www/[redacted]/public/src/XF/App.php(3011): XF\App->extension() #26 /var/www/[redacted]/public/src/XF/App.php(381): XF\App->extendClass('...') #27 /var/www/[redacted]/public/src/XF/Container.php(31): XF\App->XF\{closure}(Object(XF\Container)) #28 /var/www/[redacted]/public/src/XF/App.php(233): XF\Container->offsetGet('...') #29 /var/www/[redacted]/public/src/XF/Container.php(31): XF\App->XF\{closure}(Object(XF\Container)) #30 /var/www/[redacted]/public/src/XF/App.php(2600): XF\Container->offsetGet('...') #31 /var/www/[redacted]/public/src/XF/Error.php(431): XF\App->request() #32 /var/www/[redacted]/public/src/XF/Error.php(385): XF\Error->getExceptionTraceHtml(Object(ErrorException)) #33 /var/www/[redacted]/public/src/XF/App.php(2503): XF\Error->displayFatalExceptionMessage(Object(ErrorException)) #34 /var/www/[redacted]/public/src/XF.php(203): XF\App->displayFatalExceptionMessage(Object(ErrorException)) #35 [internal function]: XF::handleException(Object(ErrorException)) #36 {main} thrown in /var/www/[redacted]/public/src/vendor/composer/ClassLoader.php on line 576

To be able to access the site again, I have to comment out the redis stuff from config.php.
After that I can access the site / admincp again, and running the upgrade again without redis being active goes fine.
When the upgrade is completed redis can be enabled again and seems to work fine. (Might need to flush redis caches to clear out old things)

this was my test redis config:
Code:
// START Redis configuration //
// Global Cache
$config['cache']['enabled'] = true;
$config['cache']['sessions'] = true;
$config['cache']['namespace'] = 'xfredis_';
$config['cache']['provider'] = \SV\RedisCache\Redis::class;
$config['cache']['config'] = array(
    'server' => 'unix:///var/run/redis/redis.sock',
    'port' => 6379
);

If you need any other info, let me know. Tested this with my live site's backup and a completely fresh 2.2.15 installation, but the same thing happened with both.
 
Top Bottom