'pageCache' => [
'class' => 'yii\filters\PageCache',
'cache' => [
'class' => 'yii\redis\Cache',
'keyPrefix' => 'cache_yandex_map_',
'serializer' => false,
'redis' => [
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
],
],
'only' => ['static-map'],
'duration' => 60 * 60 * 12,
'enabled' => !isset($request->getAcceptableContentTypes()['text/html']),
'variations' => [
$request->get('id'),
],
],
PHP Warning – yii\base\ErrorException
mb_strlen() expects parameter 1 to be string, array given
1. in D:\projects\metering\yii2-app-advanced\vendor\yiisoft\yii2-redis\Connection.php at line 388
379380381382383384385386387388389390391392393394395396397 * @throws Exception for commands that return [error reply](http://redis.io/topics/protocol#error-reply).
*/
public function executeCommand($name, $params = [])
{
$this->open();
array_unshift($params, $name);
$command = '*' . count($params) . "\r\n";
foreach ($params as $arg) {
$command .= '$' . mb_strlen($arg, '8bit') . "\r\n" . $arg . "\r\n";
}
\Yii::trace("Executing Redis Command: {$name}", __METHOD__);
fwrite($this->_socket, $command);
return $this->parseResponse(implode(' ', $params));
}
/**
2. yii\base\ErrorHandler::handleError(2, 'mb_strlen() expects parameter 1 ...', 'D:\projects\metering\yii2-app-ad...', 388, ...)
3. in D:\projects\metering\yii2-app-advanced\vendor\yiisoft\yii2-redis\Connection.php at line 388 – mb_strlen(['...', null], '8bit')
382383384385386387388389390391392393394 {
$this->open();
array_unshift($params, $name);
$command = '*' . count($params) . "\r\n";
foreach ($params as $arg) {
$command .= '$' . mb_strlen($arg, '8bit') . "\r\n" . $arg . "\r\n";
}
\Yii::trace("Executing Redis Command: {$name}", __METHOD__);
fwrite($this->_socket, $command);
return $this->parseResponse(implode(' ', $params));
4. in D:\projects\metering\yii2-app-advanced\vendor\yiisoft\yii2-redis\Cache.php at line 130 – yii\redis\Connection::executeCommand('SET', ['SET', 'cache_yandex_map_6a86bc5cb2312e2...', ['...', null], 'PX', ...])
124125126127128129130131132133134135136 {
if ($expire == 0) {
return (bool) $this->redis->executeCommand('SET', [$key, $value]);
} else {
$expire = (int) ($expire * 1000);
return (bool) $this->redis->executeCommand('SET', [$key, $value, 'PX', $expire]);
}
}
/**
* @inheritdoc
*/
5. in D:\projects\metering\yii2-app-advanced\vendor\yiisoft\yii2\caching\Cache.php at line 220 – yii\redis\Cache::setValue('cache_yandex_map_6a86bc5cb2312e2...', ['...', null], 43200000)
6. in D:\projects\metering\yii2-app-advanced\vendor\yiisoft\yii2\widgets\FragmentCache.php at line 113 – yii\caching\Cache::set('cache_yandex_map_6a86bc5cb2312e2...', ['...', null], 43200, null)
7. in D:\projects\metering\yii2-app-advanced\vendor\yiisoft\yii2\base\Widget.php at line 73 – yii\widgets\FragmentCache::run()
8. in D:\projects\metering\yii2-app-advanced\vendor\yiisoft\yii2\base\View.php at line 466 – yii\base\Widget::end()
9. in D:\projects\metering\yii2-app-advanced\vendor\yiisoft\yii2\filters\PageCache.php at line 220 – yii\base\View::endCache()
10. yii\filters\PageCache::cacheResponse(yii\base\Event)
11. in D:\projects\metering\yii2-app-advanced\vendor\yiisoft\yii2\base\Component.php at line 541 – call_user_func([yii\filters\PageCache, 'cacheResponse'], yii\base\Event)
12. in D:\projects\metering\yii2-app-advanced\vendor\yiisoft\yii2\web\Response.php at line 315 – yii\base\Component::trigger('afterSend')
13. in D:\projects\metering\yii2-app-advanced\vendor\yiisoft\yii2\base\Application.php at line 381 – yii\web\Response::send()
14. in D:\projects\metering\yii2-app-advanced\backend\web\index.php at line 17 – yii\base\Application::run()
11121314151617 require(__DIR__ . '/../../common/config/main-local.php'),
require(__DIR__ . '/../config/main.php'),
require(__DIR__ . '/../config/main-local.php')
);
$application = new yii\web\Application($config);
$application->run();
'pageCache' => [
'class' => 'yii\filters\PageCache',
'cache' => [
'class' => FileCache::class,
'keyPrefix' => 'cache_yandex_map_',
'serializer' => false,
],
'only' => ['static-map'],
'duration' => 60 * 60 * 12,
'enabled' => !isset($request->getAcceptableContentTypes()['text/html']),
'variations' => [
$request->get('id'),
],
],