Help: yii-2 redis + predis config database separation

I want to setup redis caching for our session and cache both using predis since we have a cluster setup.
I’m using yii2-redis with predis. I’m a little confused with the config options.
The docs mention that to use the Cache component with predis the config must be:

return [
    //....
    'components' => [
        // ...
        'redis' => [
            'class' => 'yii\redis\predis\PredisConnection',
            'parameters' => 'tcp://redis:6379',
            // ...
        ],
        'cache' => [
            'class' => 'yii\redis\Cache',
        ],
        'session' => [
             'class' => 'yii\redis\Cache',
        ],
    ]
];

However i want to separate session and cache into different redis databases. Where do I place to the database => 0 statement in the session/cache config ?

If i use the following i fear that the redis key will clash with the main redis config:

return [
    //....
    'components' => [
        // ...
        'redis' => [
            'class' => 'yii\redis\predis\PredisConnection',
            'parameters' => 'tcp://redis:6379',
            // ...
        ],
        'cache' => [
            'class' => 'yii\redis\Cache',
            'redis' => [
                'database' => 1
            ]
        ],
        ...
    ]
];

Do i then separately configure the connections for session and cache and forego the main redis config on components ?
Tagging the project authors: @samdark

The most obvious way to define Redis for session and cache separately:

        'session' => [
            'class' => 'yii\redis\Session',
            'redis' => [
                'class' => 'yii\redis\predis\PredisConnection',
                'parameters' => $params['redisUri'],
                'options' => [
                    'parameters' => [
                        'database' => 0,
                        // ...
                    ],
                ]
            ],
        ],
        'cache' => [
            'class' => 'yii\redis\Cache',
            'redis' => [
                'class' => 'yii\redis\predis\PredisConnection',
                'parameters' => $params['redisUri'],
                'options' => [
                    'parameters' => [
                        'database' => 1,
                        // ...
                    ],
                ],
            ],
        ],

You can also use the redis component defined earlier:

        'redis' => [
            'class' => 'yii\redis\predis\PredisConnection',
            'parameters' => $params['redisUri'],
            'options' => [
                'parameters' => [
                    'database' => 0,
                    // ...
                ],
            ]
        ],
        'session' => function () {
            $session = new yii\redis\Session();
            $session->redis = Yii::$app->get('redis');
            $session->init();
            return $session;
        },
        'cache' => function () {
            $cache = new yii\redis\Cache();
            $predisConnection = Yii::$app->get('redis');
            $predisConnection->options['parameters']['database'] = 1;
            $cache->redis = $predisConnection;
            $cache->init();
            return $cache;
        },