Enabling Schema Caching in Yii2
Hi everyone,
Ia m rather new to yii2 so my question might be a no-brainer for you guys.
I tried to enable schema caching in yii2 so I don’t get all the SHOW FULL COLUMNS FROM Queries when using ActiveRecords all the time.
In main.php I configured a CMemCache instance
'cache' => array (
'class' => 'yii\caching\CMemCache',
),
And assigned the cache to the Connection class as follows
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=curassist',
'username' => 'some',
'password' => 'some',
'charset' => 'utf8',
'schemaCache' => 'cache',
'schemaCacheDuration' => '3600',
'enableSchemaCache' => true,
],
When I call a controller action now, I pretty much get a blank page (it stops rendering when accessing the database the first time I think) but no error or anything useful is displayed.
When I remove the
'enableSchemaCache' => true,
Or set it to false, all works fine, but oviously it doesn’t perform any caching.
Any ideas what might be wrong?
Since the debugger doesn’t even get displayed there is nothing I can think of to figure out where the cause might be.
I also tried adding server and port settings for memcache, but no difference
'cache' => array (
'class' => 'yii\caching\CMemCache',
'servers'=>array(
array(
'host'=>'localhost',
'port'=>11211,
),
),
),
Oh, and I verified that memcache is enabled.
Output from phpInfo:
memcache
memcache support enabled
Version 3.0.8
Revision $Revision: 329835 $
Directive Local Value Master Value
memcache.allow_failover 1 1
memcache.chunk_size 32768 32768
memcache.compress_threshold 20000 20000
memcache.default_port 11211 11211
memcache.hash_function crc32 crc32
memcache.hash_strategy consistent consistent
memcache.lock_timeout 15 15
memcache.max_failover_attempts 20 20
memcache.protocol ascii ascii
memcache.redundancy 1 1
memcache.session_redundancy 2 2
Any ideas?
Thanks in advance
Paul