{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/8269","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/8269/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/8269/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/8269/events","html_url":"https://github.com/yiisoft/yii2/issues/8269","id":73018976,"number":8269,"title":"Component get on Redis returns wrong connection","user":{"login":"stefandoorn","id":4903082,"avatar_url":"https://avatars.githubusercontent.com/u/4903082?v=3","gravatar_id":"","url":"https://api.github.com/users/stefandoorn","html_url":"https://github.com/stefandoorn","followers_url":"https://api.github.com/users/stefandoorn/followers","following_url":"https://api.github.com/users/stefandoorn/following{/other_user}","gists_url":"https://api.github.com/users/stefandoorn/gists{/gist_id}","starred_url":"https://api.github.com/users/stefandoorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefandoorn/subscriptions","organizations_url":"https://api.github.com/users/stefandoorn/orgs","repos_url":"https://api.github.com/users/stefandoorn/repos","events_url":"https://api.github.com/users/stefandoorn/events{/privacy}","received_events_url":"https://api.github.com/users/stefandoorn/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yiisoft/yii2/labels/feature:redis","name":"feature:redis","color":"bfd4f2"},{"url":"https://api.github.com/repos/yiisoft/yii2/labels/status:to%20be%20verified","name":"status:to be verified","color":"fbca04"}],"state":"open","locked":false,"assignee":{"login":"cebe","id":189796,"avatar_url":"https://avatars.githubusercontent.com/u/189796?v=3","gravatar_id":"","url":"https://api.github.com/users/cebe","html_url":"https://github.com/cebe","followers_url":"https://api.github.com/users/cebe/followers","following_url":"https://api.github.com/users/cebe/following{/other_user}","gists_url":"https://api.github.com/users/cebe/gists{/gist_id}","starred_url":"https://api.github.com/users/cebe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cebe/subscriptions","organizations_url":"https://api.github.com/users/cebe/orgs","repos_url":"https://api.github.com/users/cebe/repos","events_url":"https://api.github.com/users/cebe/events{/privacy}","received_events_url":"https://api.github.com/users/cebe/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/yiisoft/yii2/milestones/9","html_url":"https://github.com/yiisoft/yii2/milestones/2.0.x","labels_url":"https://api.github.com/repos/yiisoft/yii2/milestones/9/labels","id":831720,"number":9,"title":"2.0.x","description":"","creator":{"login":"cebe","id":189796,"avatar_url":"https://avatars.githubusercontent.com/u/189796?v=3","gravatar_id":"","url":"https://api.github.com/users/cebe","html_url":"https://github.com/cebe","followers_url":"https://api.github.com/users/cebe/followers","following_url":"https://api.github.com/users/cebe/following{/other_user}","gists_url":"https://api.github.com/users/cebe/gists{/gist_id}","starred_url":"https://api.github.com/users/cebe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cebe/subscriptions","organizations_url":"https://api.github.com/users/cebe/orgs","repos_url":"https://api.github.com/users/cebe/repos","events_url":"https://api.github.com/users/cebe/events{/privacy}","received_events_url":"https://api.github.com/users/cebe/received_events","type":"User","site_admin":false},"open_issues":337,"closed_issues":2,"state":"open","created_at":"2014-10-19T13:49:45Z","updated_at":"2015-05-05T21:12:13Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-05-04T13:27:35Z","updated_at":"2015-05-05T21:15:45Z","closed_at":null,"body":"I have a weird issue I can't get the solution for. I try to get the connection 'redis2' but in my frontend app it keeps returning me the information set on 'redis'. Might be some interference as the cache driver is loaded before, but still. On my console it works as expected. \r\n\r\nI have two Redis connections:\r\n\r\n    'components.redis' => [\r\n        'class' => 'yii\\redis\\Connection',\r\n        'hostname' => 'localhost',\r\n        'port' => 6379,\r\n        'database' => 0,\r\n    ],\r\n    'components.redis2' => [\r\n        'class' => 'yii\\redis\\Connection',\r\n        'hostname' => '127.0.0.1',\r\n        'port' => 6379,\r\n        'database' => 1,\r\n    ],\r\n\r\nIn my frontend app this:\r\n\r\n        echo '<pre>';\r\n        print_r(\\Yii::$app->get('redis'));\r\n        print_r(\\Yii::$app->get('redis2'));\r\n        exit;\r\n\r\nResults in:\r\n````\r\nyii\\redis\\Connection Object\r\n(\r\n    [hostname] => localhost\r\n    [port] => 6379\r\n    [unixSocket] => \r\n    [password] => \r\n    [database] => 0\r\n````\r\n&\r\n````\r\nyii\\redis\\Connection Object\r\n(\r\n    [hostname] => localhost\r\n    [port] => 6379\r\n    [unixSocket] => \r\n    [password] => \r\n    [database] => 0\r\n````\r\nWhile doing the same on my console command gives:\r\n````\r\nyii\\redis\\Connection Object\r\n(\r\n    [hostname] => localhost\r\n    [port] => 6379\r\n    [unixSocket] =>\r\n    [password] =>\r\n    [database] => 0\r\n````\r\n&\r\n````\r\nyii\\redis\\Connection Object\r\n(\r\n    [hostname] => 127.0.0.1\r\n    [port] => 6379\r\n    [unixSocket] =>\r\n    [password] =>\r\n    [database] => 1\r\n````\r\n\r\nI've been digging in this problem for a while now. Ofcourse I can solve it by using one connection and switching database, but I would like to keep it split to support separating things later on in the process. I might be overlooking something, or it might be a bug. "},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/99224258","html_url":"https://github.com/yiisoft/yii2/issues/8269#issuecomment-99224258","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/8269","id":99224258,"user":{"login":"cebe","id":189796,"avatar_url":"https://avatars.githubusercontent.com/u/189796?v=3","gravatar_id":"","url":"https://api.github.com/users/cebe","html_url":"https://github.com/cebe","followers_url":"https://api.github.com/users/cebe/followers","following_url":"https://api.github.com/users/cebe/following{/other_user}","gists_url":"https://api.github.com/users/cebe/gists{/gist_id}","starred_url":"https://api.github.com/users/cebe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cebe/subscriptions","organizations_url":"https://api.github.com/users/cebe/orgs","repos_url":"https://api.github.com/users/cebe/repos","events_url":"https://api.github.com/users/cebe/events{/privacy}","received_events_url":"https://api.github.com/users/cebe/received_events","type":"User","site_admin":false},"created_at":"2015-05-05T21:15:45Z","updated_at":"2015-05-05T21:15:45Z","body":"> 'components.redis' => [\r\n\r\nthis is not what goes into the final application configuration, please check the 'components' section of the application config if you assign it correctly."}}