{"action":"reopened","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/11419","repository_url":"https://api.github.com/repos/yiisoft/yii2","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/11419/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/11419/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/11419/events","html_url":"https://github.com/yiisoft/yii2/issues/11419","id":150849438,"number":11419,"title":"Redis(?) cache memory leak","user":{"login":"djeux","id":2291051,"avatar_url":"https://avatars.githubusercontent.com/u/2291051?v=3","gravatar_id":"","url":"https://api.github.com/users/djeux","html_url":"https://github.com/djeux","followers_url":"https://api.github.com/users/djeux/followers","following_url":"https://api.github.com/users/djeux/following{/other_user}","gists_url":"https://api.github.com/users/djeux/gists{/gist_id}","starred_url":"https://api.github.com/users/djeux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djeux/subscriptions","organizations_url":"https://api.github.com/users/djeux/orgs","repos_url":"https://api.github.com/users/djeux/repos","events_url":"https://api.github.com/users/djeux/events{/privacy}","received_events_url":"https://api.github.com/users/djeux/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-25T13:01:15Z","updated_at":"2016-04-25T18:23:53Z","closed_at":null,"body":"I'm building a queue system for Yii2 with beanstalkd. I've got a console controller to run in a loop checking for new jobs.\r\n\r\n`````php\r\n    while ($run) {\r\n            $job = $queue->listen($tubeName);\r\n\r\n            if (null !== $job) {\r\n                try {\r\n                    $job->handle();\r\n                } catch (Exception $e) {\r\n                    $this->stderr($e->getMessage());\r\n                    Yii::error($e->getMessage(), 'queue.' . $tubeName);\r\n                    $job->release();\r\n                }\r\n            }\r\n\r\n            if ($this->isStopped() || $this->shouldRestart()) {\r\n                $run = false;\r\n            }\r\n        }\r\n\r\n```````\r\n\r\nIf I run it inside a loop I will constantly get increased memory usage (without handling any jobs). After cutting parts of the loop I found out that\r\n```php\r\n$this-isStopped() and $this->shouldRestart() \r\n```\r\nIs causing it. The methods simply check for a key to be present inside cache (redis)\r\n\r\n```php\r\nif (Yii::$app->cache->get(self::RESTART_CACHE_KEY)) {\r\n            $this->stdout(\"Restarting worker\");\r\n            return true;\r\n        }\r\n        \r\n        return false;\r\n```\r\n\r\nSo just checking cache is taking more and more memory?\r\n\r\nYii 2.0.7"}}