| @@ 97-112 (lines=16) @@ | ||
| 94 | Yii::beginProfile('Get all theme parts'); |
|
| 95 | ||
| 96 | static::$allParts= Yii::$app->cache->get($cacheKey); |
|
| 97 | if (static::$allParts=== false) { |
|
| 98 | static::$allParts= ThemeParts::find() |
|
| 99 | ->where(['global_visibility'=>1]) |
|
| 100 | ->asArray() |
|
| 101 | ->all(); |
|
| 102 | Yii::$app->cache->set( |
|
| 103 | $cacheKey, |
|
| 104 | static::$allParts, |
|
| 105 | 86400, |
|
| 106 | new TagDependency([ |
|
| 107 | 'tags' => [ |
|
| 108 | ActiveRecordHelper::getCommonTag(ThemeVariation::className()), |
|
| 109 | ] |
|
| 110 | ]) |
|
| 111 | ); |
|
| 112 | } |
|
| 113 | Yii::endProfile('Get all theme parts'); |
|
| 114 | } |
|
| 115 | return static::$allParts; |
|
| @@ 92-107 (lines=16) @@ | ||
| 89 | $cacheKey = 'AllThemeVariations'; |
|
| 90 | ||
| 91 | static::$allVariations = Yii::$app->cache->get($cacheKey); |
|
| 92 | if (static::$allVariations === false) { |
|
| 93 | static::$allVariations = ThemeVariation::find() |
|
| 94 | ->orderBy(['exclusive' => SORT_DESC]) |
|
| 95 | ->asArray() |
|
| 96 | ->all(); |
|
| 97 | Yii::$app->cache->set( |
|
| 98 | $cacheKey, |
|
| 99 | static::$allVariations, |
|
| 100 | 86400, |
|
| 101 | new TagDependency([ |
|
| 102 | 'tags' => [ |
|
| 103 | ActiveRecordHelper::getCommonTag(ThemeVariation::className()), |
|
| 104 | ] |
|
| 105 | ]) |
|
| 106 | ); |
|
| 107 | } |
|
| 108 | } |
|
| 109 | return static::$allVariations; |
|
| 110 | } |
|