Redis Cache By Xon

Redis Cache By Xon 2.18.1

No permission to download
Everything works like it should but was wondering what the following meant:
Code:
        'compress_data' => 6,
 
It is the compression level to be sent to the compression function, as for large blobs (ie css) it compresses it. For css it actually stores gzip'ed compressed data which can be simply sent to the client without decompressing it locally.
 
  • Like
Reactions: jul
There’s an example file in the add on .rar

Yes but Currently i am using this code. Do we need adding anything for enable guest page cache?

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(
'server' => '127.0.0.1',
'port' => 6379,
'connect_retries' => 2,
'use_lua' => true,
'compress_data' => 6,
'read_timeout' => 1,
'timeout' => 1,
'serializer' => 'igbinary',
//        'serializer' => 'php',
'persistent' => true,
);
// END Redis configuration //
 
@Xon How to enable built in XF 2.1 guest page cache? Do we need adding any code in config.php?
See the Xenforo manual; Guest page caching
Guest page caching
XenForo 2.1 has the option to cache guest page views for a period of time. This can reduce the overhead caused by guests browsing the site, potentially reducing overall server load.

Guest page caching can cause a large amount of data to be cached. Therefore, the page cache requires that you setup a specific page cache context. If this is not done, page caching will not be enabled. We recommend using a separate cache "instance" for the global and page caches to ensure that the page cache does not force data such as sessions out of the global cache.

A basic page cache setup requires the following code to be added to the src/config.php file:

Code:
$config['cache']['enabled'] = true;
$config['pageCache']['enabled'] = true;
$config['cache']['context']['page']['provider'] = 'CacheProvider';
$config['cache']['context']['page']['config'] = [];

The CacheProvider value and the configuration for that provider will need to be modified to refer to a specific cache type and the necessary configuration for it. See the cache contexts section for more detail.

When a page is served from the cache, a X-XF-Cache-Status: HIT header will be present in the response.

This add-on isn't anything special for pageCache support
 
@Xon does this Server error log from your add-on or from @ThemeHouse [TH] Covers add-on?

Code:
Error: Cannot use object of type SV\RedisCache\Redis as array src/addons/ThemeHouse/Covers/Repository/CoverHandler.php:46

Generated by: Nirjonmela Jun 25, 2019 at 10:45 PM

Stack trace

#0 src/addons/ThemeHouse/Covers/Entity/CoverPreset.php(122): ThemeHouse\Covers\Repository\CoverHandler->getCoverHandlers()
#1 src/XF/Mvc/Entity/Entity.php(148): ThemeHouse\Covers\Entity\CoverPreset->getDefaultNames()
#2 src/XF/Mvc/Entity/Entity.php(106): XF\Mvc\Entity\Entity->get('default_names')
#3 internal_data/code_cache/templates/l1/s0/admin/thcovers_cover_preset_list.php(14): XF\Mvc\Entity\Entity->offsetGet('default_names')
#4 src/XF/Template/Templater.php(701): XF\Template\Templater->{closure}(Object(AddonFlare\PaidRegistrations\XF\Template\Templater), Array, Array)
#5 internal_data/code_cache/templates/l1/s0/admin/thcovers_cover_preset_list.php(117): XF\Template\Templater->callMacro('thcovers_cover_...', 'preset', Array, Array)
#6 src/XF/Template/Templater.php(1301): XF\Template\Templater->{closure}(Object(AddonFlare\PaidRegistrations\XF\Template\Templater), Array)
#7 src/addons/AddonsLab/LinkChecker/XF/Template/Templater.php(89): XF\Template\Templater->renderTemplate('thcovers_cover_...', Array, true)
#8 src/XF/Template/Template.php(24): AddonsLab\LinkChecker\XF\Template\Templater->renderTemplate('admin:thcovers_...', Array)
#9 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#10 src/XF/Mvc/Dispatcher.php(418): XF\Mvc\Renderer\Html->renderView('ThemeHouse\\Cove...', 'admin:thcovers_...', Array)
#11 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#12 src/XF/Mvc/Dispatcher.php(360): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#13 src/XF/Mvc/Dispatcher.php(53): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#14 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
#15 src/XF.php(390): XF\App->run()
#16 admin.php(13): XF::runApp('XF\\Admin\\App')
#17 {main}

Request state

array(4) {
  ["url"] => string(25) "/admin.php?cover-presets/"
  ["referrer"] => string(32) "/admin.php"
  ["_GET"] => array(1) {
    ["cover-presets/"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}
 
@Xon does this Server error log from your add-on or from @ThemeHouse [TH] Covers add-on?

Code:
Error: Cannot use object of type SV\RedisCache\Redis as array src/addons/ThemeHouse/Covers/Repository/CoverHandler.php:46

Generated by: Nirjonmela Jun 25, 2019 at 10:45 PM

Stack trace

#0 src/addons/ThemeHouse/Covers/Entity/CoverPreset.php(122): ThemeHouse\Covers\Repository\CoverHandler->getCoverHandlers()
#1 src/XF/Mvc/Entity/Entity.php(148): ThemeHouse\Covers\Entity\CoverPreset->getDefaultNames()
#2 src/XF/Mvc/Entity/Entity.php(106): XF\Mvc\Entity\Entity->get('default_names')
#3 internal_data/code_cache/templates/l1/s0/admin/thcovers_cover_preset_list.php(14): XF\Mvc\Entity\Entity->offsetGet('default_names')
#4 src/XF/Template/Templater.php(701): XF\Template\Templater->{closure}(Object(AddonFlare\PaidRegistrations\XF\Template\Templater), Array, Array)
#5 internal_data/code_cache/templates/l1/s0/admin/thcovers_cover_preset_list.php(117): XF\Template\Templater->callMacro('thcovers_cover_...', 'preset', Array, Array)
#6 src/XF/Template/Templater.php(1301): XF\Template\Templater->{closure}(Object(AddonFlare\PaidRegistrations\XF\Template\Templater), Array)
#7 src/addons/AddonsLab/LinkChecker/XF/Template/Templater.php(89): XF\Template\Templater->renderTemplate('thcovers_cover_...', Array, true)
#8 src/XF/Template/Template.php(24): AddonsLab\LinkChecker\XF\Template\Templater->renderTemplate('admin:thcovers_...', Array)
#9 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#10 src/XF/Mvc/Dispatcher.php(418): XF\Mvc\Renderer\Html->renderView('ThemeHouse\\Cove...', 'admin:thcovers_...', Array)
#11 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#12 src/XF/Mvc/Dispatcher.php(360): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#13 src/XF/Mvc/Dispatcher.php(53): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#14 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
#15 src/XF.php(390): XF\App->run()
#16 admin.php(13): XF::runApp('XF\\Admin\\App')
#17 {main}

Request state

array(4) {
  ["url"] => string(25) "/admin.php?cover-presets/"
  ["referrer"] => string(32) "/admin.php"
  ["_GET"] => array(1) {
    ["cover-presets/"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}
This is a bug in Covers v1.0.4;

They have; $this->app()->cache('addon.cache')['XFRM'] it should be $this->app()->container('addon.cache')['XFRM']
 
hello,

I installed Redis (PHP extension for interfacing with Redis) via WHM, after that I installed add-on and then I added below code to config.

Code:
$config['cache']['enabled'] = true;
$config['cache']['provider'] = 'SV\RedisCache\Redis';
$config['cache']['config']  = array(
        'server' => '127.0.0.1',
        'port' => 6379,
    );

I have faced two problems

1. Forum got blank page
2. It doesn't show Redis statistics in ACP

Where I maid mistake?
Go to {your forum url}/install, login and click on Rebuilt Master Data and try it again after the rebuilt.
 
Xon updated Redis Cache By Xon with a new update entry:

2.6.1 - CSS/LESS caching changes

  • Remove "Disable individual css cache" option.
    • While the xf_css_cache table is subject to 'thundering herd' issues; it still provides a benefit during cache rebuilds and the frequent invalidation is a XF issue with it's usage
  • Implement short (~5 minute) caching of individual css templates & parse_less_color/parse_less_func functions (parse_less_func is from Advanced BbCodes Pack). Minor, but measurable performance improvement
    • When caching is enabled...

Read the rest of this update entry...
 
Redis is ticked in my phpsetting but when I add the code to config.php the forum goes blank including the url/install

Im doing something wrong?

Code:
$config['cache']['enabled'] = true;
$config['cache']['provider'] = 'SV\RedisCache\Redis';
$config['cache']['config']  = array(
        'server' => '127.0.0.1',
        'port' => 6379,
        'compress_data' => 6,
    );
 
Can you run sudo netstat -antp | grep 6379 | grep -i listen

Is redis actually installed & running?
 
Can you run sudo netstat -antp | grep 6379 | grep -i listen

Is redis actually installed & running?
Im not a linux here as I basically run the whole server from plesk. That line showed nothing so typed netstat -ant | grep LISTEN and I don't see the port

Alright, looked up how to install it I think I have it installed now, going to test shorty.

Alrighty, I got it working :). As I added it all manually through the console, do I need to configure anything extra for security or something?
 
Last edited:
Redis should only be listening on local-host and not a publicly accessible IP, which should be the default configuration. That is about it for security.
 
Redis should only be listening on local-host and not a publicly accessible IP, which should be the default configuration. That is about it for security.
Ok, its show this ATM so I guess it's set ok?
sudo netstat -antp | grep 6379 | grep -i listen tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 1481/redis-server 1
 
Back
Top Bottom