Redis for cache.

@serbanovvostrov - you need to open main-custom.php file from 'path_to_your_app'/apps/common/config/ and insert:
Code:
'components' => array(

    // ADD REDIS FOR CACHE/MUTEX START
    'cache' => array(
        'class' => 'common.components.cache.RedisCache',
    ),
    'mutex' => array(
        'class' => 'common.components.mutex.RedisMutex',
    ),
    // ADD REDIS FOR CACHE/MUTEX END
),
 
where do I set the redis host?

There you go:
PHP:
// ADD REDIS FOR CACHE/MUTEX START
    'cache' => array(
        'class' => 'common.components.cache.RedisCache',
        'hostname' => '...',
        'username' => '...',
        'password' => '...',
        'port'       => '...',
    ),
    'mutex' => array(
        'class' => 'common.components.mutex.RedisMutex',
        'hostname' => '...',
        'username' => '...',
        'password' => '...',
        'port'       => '...',
    ),
    // ADD REDIS FOR CACHE/MUTEX END
 
@twisted1919

my main custom file looks like,, but when ever i enable username and password for redis we get error in the application. when i comment the username and password in redis it works

1. Can you please look at your end if mailwizz works if we specify the username and password in redis.
also is there any method to pass the database name in redis so that we can have a separate database for mutex and cache.

2. We know that many times when server shutdown unexpectedly or PHP processes are shut down , the mutex lock restricts the campaign sender, and to resolve that we need to flush the database of mutex

3. is there any way to find out or identify right mutex file, so that we can flush that rather then flushing all mutex!!


Code:
return [

    // application components
    'components' => [
        'db' => [
            'connectionString'  => 'mysql:host=db.host;dbname=db-name',
            'username'          => 'app-user',
            'password'          => 'pass',
            'tablePrefix'       => 'app_',
        ],
            // ADD REDIS FOR CACHE/MUTEX START
    'cache' =>   [
        'class' => 'common.components.cache.RedisCache',
        'hostname' => 'cache.host.com',
       // 'username' => 'app-cache', 
      //  'password' => 'cache-pass',
        'port'     => '6379',
        ],

    'mutex' =>  [
        'class' => 'common.components.mutex.RedisMutex',
          'hostname' => 'cache.host.com',
       // 'username' => 'app-cache',
      //  'password' => 'cache-pass',
        'port'     => '6379',
        ],
    ],
  

  

    // params
    'params' => [
        'email.custom.header.prefix' => 'X-',
    ],
];
 
1. Can you please look at your end if mailwizz works if we specify the username and password in redis.
also is there any method to pass the database name in redis so that we can have a separate database for mutex and cache.
AFAIK the username in Redis is something relatively new, so we have no support for it yet, but we're using Predis as the PHP Client so we can add it for the enxt release. For both cache and mutex.
You can pass the database like
Code:
'database' => 1,

3. is there any way to find out or identify right mutex file, so that we can flush that rather then flushing all mutex!!
That's not possible, just store the mutex in a separate redis database and flush that.
 
Back
Top