CGlobalStateCacheDependency not works

Hello. This is the scenario:


        $dep_partes = Yii::app()->db->createCommand()

            ->select('MAX(UNIX_TIMESTAMP(updated)) as updated')

            ->from('{{partes}}')

            ->queryRow();

        $dep_personas = Yii::app()->db->createCommand()

            ->select('MAX(UNIX_TIMESTAMP(updated)) as updated')

            ->from('{{personas}}')

            ->queryRow();


        Yii::app()->setGlobalState('cacheListarPersonasExpediente', 

             $dep_partes['updated'].$dep_personas['updated']

        );


        $dep = new CGlobalStateCacheDependency('cacheListarPersonasExpediente');


        $m_personas=Personas::model()->cache(600,$dep)->findAll();



The $m_personas model doesn’t refresh the values when table {{personas}} is updated. Allways get cached.

Note that i’ve traced Yii::app()->getGlobalState(‘cacheListarPersonasExpediente’)

and the value is renewed, but the cache is not refreshing.

Is something wrong?

Hi Nacesprin

Are you sure the concatenated $dep_partes[‘updated’].$dep_personas[‘updated’] is different when updated on of them

check first with var_dump the result to see whether the problem is the CGlobalStateCacheDependency.