fusio icon indicating copy to clipboard operation
fusio copied to clipboard

using redis cache

Open SavvyEngineer opened this issue 3 years ago • 2 comments

hi i wanted to use redis cache system so I installed the adapter using

composer require fusio/adapter-redis
php bin/fusio system:register "Fusio\Adapter\Redis\Adapter"

and then I went to add it in configuration using this

   'psx_cache_factory'       => function($config, $namespace){
        $client = new \Predis\Client([
                'scheme' => 'tcp',
                'host'   => '127.0.0.1',
                'port'   => 6379,
        ]);

        return new \Doctrine\Common\Cache\PredisCache($client);
},

bot I'm getting this error

PHP Fatal error:  Uncaught Error: Class "Doctrine\\Common\\Cache\\PredisCache" not found in /--/--/---/configuration.php

what should I do? and is there any way that every action uses redis from the start because I'm using the default sql-actions that are already implemented in fusio and I have all my actions already implemented so going back and creating the customized ones it's a lot of time, using psx_cache_factory would do this for me?? thanks and best of regards

SavvyEngineer avatar Jul 21 '22 10:07 SavvyEngineer

Hi, ok so in newer version of Fusio the psx_cache_factory config should return a Symfony cache adapter, I have also just updated the php docs s. https://github.com/apioo/fusio/blob/master/configuration.php#L121 Despite this the cache factory only configures the internal cache of Fusio, if you want to cache your actions then you would need to use the UtilCache action, for this you would also need to create a Redis Connection which you can use at the Cache action, but there is currently no way to automatically cache all actions.

chriskapp avatar Aug 05 '22 18:08 chriskapp

Hi, ok so in newer version of Fusio the psx_cache_factory config should return a Symfony cache adapter, I have also just updated the php docs s. https://github.com/apioo/fusio/blob/master/configuration.php#L121 Despite this the cache factory only configures the internal cache of Fusio, if you want to cache your actions then you would need to use the UtilCache action, for this you would also need to create a Redis Connection which you can use at the Cache action, but there is currently no way to automatically cache all actions.

Thanks for your clarification ✌️🙏

SavvyEngineer avatar Aug 05 '22 18:08 SavvyEngineer