E
E
EVOSandru62015-07-31 10:13:05
Yii
EVOSandru6, 2015-07-31 10:13:05

How to connect in yii in opcache configuration?

Greetings, The CApcCache class is
registered in the configuration for cache :

'components'=>
[
...
'cache' =>
    [
        'class'=> 'CApcCache',

    ],
...
]

In the controller in the filter it is written:
[
                'COutputCache + create',
                'duration'=> 24 * 3600 * 365,
                'dependency'=>
                [
                    'class'=>'CChainedCacheDependency',
                    'dependencies'=>
                    [
                        new CGlobalStateCacheDependency('t_places'),
                        new CDbCacheDependency("SELECT  sys_date_update FROM t_places")
                    ]
                ]
            ]

At the same time, 22000 records from the table in the database are loaded, after the page is reloaded it loads quickly.
On the local server - php 5.4 and php_apc.dll , which is not supported in higher versions.
There is a need to use php 5.6 and opcache , I uncommented php.ini :
[opcache]
zend_extension="%sprogdir%/modules/php/%phpdriver%/ext/php_opcache.dll"
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1

What needs to be changed in the configuration so that opcache is used as a cache?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan GiBSON, 2015-07-31
@gibson_dev

It is only important to remember that when moving from APC to OpCache, the latter does not work as a data caching engine.
OpCache is only a bytecode caching engine, so it does not offer similar data caching functionality.
It automatically caches the byte code that executes

K
kompi, 2015-07-31
@kompi

It is important to remember the difference between a data cache and a byte code. Then there will be no questions about enabling opcache as a data cache.
If you need a data cache, then it's one of these - memcache, redis, cut apc for php > 5.5, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question