| @@ 108-119 (lines=12) @@ | ||
| 105 | return $query; |
|
| 106 | } |
|
| 107 | $result = $query->all(); |
|
| 108 | if (true === $asArray) { |
|
| 109 | Yii::$app->cache->set( |
|
| 110 | $cache_key, |
|
| 111 | $result, |
|
| 112 | 0, |
|
| 113 | new TagDependency([ |
|
| 114 | 'tags' => [ |
|
| 115 | ActiveRecordHelper::getCommonTag(static::className()) |
|
| 116 | ], |
|
| 117 | ]) |
|
| 118 | ); |
|
| 119 | } |
|
| 120 | return $result; |
|
| 121 | } |
|
| 122 | ||
| @@ 167-178 (lines=12) @@ | ||
| 164 | return $query; |
|
| 165 | } |
|
| 166 | $result = $query->all(); |
|
| 167 | if (true === $asArray) { |
|
| 168 | Yii::$app->cache->set( |
|
| 169 | $cache_key, |
|
| 170 | $result, |
|
| 171 | 0, |
|
| 172 | new TagDependency([ |
|
| 173 | 'tags' => [ |
|
| 174 | ActiveRecordHelper::getCommonTag(static::className()) |
|
| 175 | ], |
|
| 176 | ]) |
|
| 177 | ); |
|
| 178 | } |
|
| 179 | return $result; |
|
| 180 | } |
|
| 181 | ||
| @@ 166-179 (lines=14) @@ | ||
| 163 | ] |
|
| 164 | ) |
|
| 165 | ->all(); |
|
| 166 | if (!empty($models)) { |
|
| 167 | Yii::$app->cache->set( |
|
| 168 | $cacheKey, |
|
| 169 | $models, |
|
| 170 | 86400, |
|
| 171 | new TagDependency( |
|
| 172 | [ |
|
| 173 | 'tags' => [ |
|
| 174 | ActiveRecordHelper::getCommonTag(Review::className()), |
|
| 175 | ], |
|
| 176 | ] |
|
| 177 | ) |
|
| 178 | ); |
|
| 179 | } |
|
| 180 | } |
|
| 181 | return $models; |
|
| 182 | } |
|
| @@ 315-327 (lines=13) @@ | ||
| 312 | ) |
|
| 313 | ); |
|
| 314 | return $category; |
|
| 315 | } else { |
|
| 316 | Yii::$app->cache->set( |
|
| 317 | "Category:bySlug:" . $identity_key, |
|
| 318 | $category, |
|
| 319 | 86400, |
|
| 320 | new TagDependency( |
|
| 321 | [ |
|
| 322 | 'tags' => ActiveRecordHelper::getCommonTag(Category::className()) |
|
| 323 | ] |
|
| 324 | ) |
|
| 325 | ); |
|
| 326 | return null; |
|
| 327 | } |
|
| 328 | } else { |
|
| 329 | return $category; |
|
| 330 | } |
|