ai-cache class redis not found

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
dicko_luxo
Posts: 2
Joined: 10 Jul 2023, 20:02

ai-cache class redis not found

Post by dicko_luxo » 11 Jul 2023, 14:37

Hello there..

Currently using:
Laravel 10.14.1
Aimeos 2023.07.1
ai-cache 2023.04.1
PHP 8.2
Ubuntu 22.04

I just installed a fresh Aimeos, and then followed by installing redis-server (added requirepass). And then I installed ai-cache ( https://github.com/aimeos/ai-cache ).

/config/shop.php :

Code: Select all

        return [
            ...
            'resource' => [
                ...
                'cache' => [
                    'redis' => [
                        'scheme' => 'tcp',
                        'host' => '127.0.0.1',
                        'port' => 6379,
                        'password' => 'blahblah',
                    ],
                ],
            ],
        ];
Afterwards, I checked through redis-cli if any keys are registered when I open a product/page in the site. Since I don't see any new keys added, I assume ai-cache is NOT working yet (please correct me if I'm wrong). So based on another thread here, I added the following in /config/shop.php:

Code: Select all

        return [
            ...
            'madmin' => [
                'cache' => [
                    'manager' => [
                        'name' => 'redis',
                    ],
                ],
            ],
        ];
Afterwards, when I run "php artisan aimeos:clear", I got the following error message:

Code: Select all

LogicException

Class "\Aimeos\MAdmin\Cache\Manager\redis" not found

at vendor/aimeos/aimeos-core/src/Utils.php:20

So I have two questions:

1. Can anybody please let me know if I've made any mistake during installation process for ai-cache?

2. Can anybody tell me how to check if ai-cache is already working as intended?

Thanks in advance!

User avatar
aimeos
Administrator
Posts: 7908
Joined: 01 Jan 1970, 00:00

Re: ai-cache class redis not found

Post by aimeos » 12 Jul 2023, 11:28

First, you need a package version that matches the Aimeos version, i.e. "2023.07.x" in your case:

Code: Select all

composer req aimeos/ai-cache:2023.07.*
Then, the name of the manager name must be in upper case:

Code: Select all

        return [
            'madmin' => [
                'cache' => [
                    'manager' => [
                        'name' => 'Redis',
                    ],
                ],
            ],
        ];
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

dicko_luxo
Posts: 2
Joined: 10 Jul 2023, 20:02

Re: ai-cache class redis not found

Post by dicko_luxo » 12 Jul 2023, 15:38

Thanks for the reply. I've tried doing these 2 points, and I got a different error message now when running "php artisan aimeos:clear" :

Code: Select all

  Predis\Response\ServerException

  NOAUTH Authentication required.

  at vendor/predis/predis/src/Client.php:370
I assume this is because I use requirepass in redis.conf, so I try removing the password, and no more error message. BUT when I open shop page, or admin page, there are still no new keys created in the redis database. So I'm still not 100% sure if ai-cache is indeed working or not.

So my questions are:

1. If I want to add a password to redis, what config should I add?

2. How do I test if ai-cache is working properly?

Thanks in advance!

User avatar
aimeos
Administrator
Posts: 7908
Joined: 01 Jan 1970, 00:00

Re: ai-cache class redis not found

Post by aimeos » 13 Jul 2023, 05:53

The Predis library contains not much information about password authentication but it seems you need "username" AND "password": https://github.com/predis/predis#connecting-to-redis
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply