@hollanditkzn

Как включить кэширование rbac?

Я пробовал использовать данный пример https://habrahabr.ru/post/251847/ кэширование rbac
Но у меня вышло после такого кода common/config/main.php
'components' => [
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
        'cacheRbac' => [
            'class' => 'yii\caching\ApcCache',
        ]
    ],

common/config/main-local.php
return => [
'components' => [
'authManager' => [
            'class' => 'yii\rbac\DbManager',
            'cache' => 'cacheRbac',
        ],
}
]

И пишет проблему ApcCache requires PHP apc extension to be loaded.
Как я понял там там нет этого расширение и второй момент как его загрузить.
Я уже зашел на сайт www.php.net/apc, мне нужно что-то установить как понимаю и второй момент как это потом передать на хостинг?
И у меня версия php 5.6
  • Вопрос задан
  • 1094 просмотра
Решения вопроса 1
webinar
@webinar Куратор тега Yii
Учим yii: https://youtu.be/-WRMlGHLgRg
1. Вот гайд по установке Apc: sitear.ru/material/apc-php
2. Не обязательно использовать для rbac apc, он будет работать и с другими видами кеша. Выбирайте:
  1. yii\caching\ApcCache: uses PHP APC extension. This option can be considered as the fastest one when dealing with cache for a centralized thick application (e.g. one server, no dedicated load balancers, etc.).
  2. yii\caching\DbCache: uses a database table to store cached data. To use this cache, you must create a table as specified in yii\caching\DbCache::$cacheTable.
  3. yii\caching\DummyCache: serves as a cache placeholder which does no real caching. The purpose of this component is to simplify the code that needs to check the availability of cache. For example, during development or if the server doesn't have actual cache support, you may configure a cache component to use this cache. When an actual cache support is enabled, you can switch to use the corresponding cache component. In both cases, you may use the same code Yii::$app->cache->get($key) to attempt retrieving data from the cache without worrying that Yii::$app->cache might be null.
  4. yii\caching\FileCache: uses standard files to store cached data. This is particularly suitable to cache large chunk of data, such as page content.
  5. yii\caching\MemCache: uses PHP memcache and memcached extensions. This option can be considered as the fastest one when dealing with cache in a distributed applications (e.g. with several servers, load balancers, etc.)
  6. yii\redis\Cache: implements a cache component based on Redis key-value store (redis version 2.6.12 or higher is required).
  7. yii\caching\WinCache: uses PHP WinCache (see also) extension.
  8. yii\caching\XCache: uses PHP XCache extension.
  9. Zend Data Cache as the underlying caching medium.

Вот тут подробнее: www.yiiframework.com/doc-2.0/guide-caching-data.html
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы