Alegz
(Al)
1
Hi.
Recently I was using active record, and faced some problem.
I wanted to configure my db component to cache table schema.
I put in my main.php, in db component parameter
schemaCachingDuration = 86400
Manual: http://www.yiiframework.com/doc/api/1.1/CDbConnection#schemaCachingDuration-detail
According to the manual this option says to db to cache data about schema for 86400 seconds (one day), but when I switched on profiling I see this
system.db.CDbCommand.query(SHOW COLUMNS FROM some_table
)
If I am not mistaking this request should be run once in a day, but Yii does it every controller load.
Maybe I missed something.
Have somebody faced this problem?
MehdiA
(Abderezai)
2
I had the same issue, did you find an answer Algez?
rungss
(Bijay Rungta)
3
I was also trying to figure this out and found the solution.
You must enable caching for it to be effective.
Notice this:
If greater than 0 and the primary cache is enabled, the table metadata will be cached.
To set Caching, see Caching Overview
You will have to add Caching setting in Configuration, For Memcache you can use this:
'components'=>array(
......
'cache'=>array(
'class'=>'system.caching.CMemCache',
'servers'=>array(
array('host'=>'server1', 'port'=>11211, 'weight'=>60),
array('host'=>'server2', 'port'=>11211, 'weight'=>40),
),
),
),
Alegz
(Al)
4
Yep this is a solution, I found that out after 2-3 days.
I didn’t mension that my cache class was CDummyCache, that was the reason.
Thank you for reply.
By the way, memcache is the best way of caching only if you don’t run your project on Pentium 1. =)