E
E
EVOSandru62015-07-31 07:40:44
Yii
EVOSandru6, 2015-07-31 07:40:44

Is it possible to use multiple selects in CDbCacheDependency in YII?

Hello,
Is it possible to use multiple select queries in CDbCacheDependency to track changes in more than one table?
If not, are multiple fields from different tables parsed similar to this query:

new CDbCacheDependency("SELECT
                                                    MAX(t_places.sys_date_update),
                                                    MAX(t_category_cargo.sys_date_update)
                                                FROM
                                                    t_places
                                                            JOIN
                                                    t_cargo;")

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Khomenko, 2015-07-31
@EVOSandru6

From the working project, which is in Yii2:

SELECT
    ( SELECT CONCAT( MAX( fd_config_item.date_created ), MAX( fd_config_item.date_edited ) ) FROM fd_config_item ) fd_config_item,
    ( SELECT CONCAT( MAX( fd_config_item_group.date_created ), MAX( fd_config_item_group.date_edited ) ) FROM fd_config_item_group ) fd_config_item_group

As you can see from the query, this is a dependency on two tables in the database: fd_config_item and fd_config_item_group. Requests are generated automatically, in a specially created DbTimestampDependency: https://github.com/iiifx-production/yii2-db-timest...

M
matperez, 2015-07-31
@matperez

I don’t know how in the first one, but in the second one you can link several dependencies into one www.yiiframework.com/doc-2.0/yii-caching-chainedde... Probably, you can build something similar for the first Yii.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question