Skip to content

Commit e8e2676

Browse files
committed
Cache checking #87
1 parent 3a2cd51 commit e8e2676

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

models/rbacDB/Route.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public static function isFreeAccess($route, $action = null)
228228
*/
229229
protected static function isInCommonPermission($currentFullRoute)
230230
{
231-
$commonRoutes = Yii::$app->cache->get('__commonRoutes');
231+
$commonRoutes = Yii::$app->cache ? Yii::$app->cache->get('__commonRoutes') : false;
232232

233233
if ( $commonRoutes === false )
234234
{
@@ -240,7 +240,8 @@ protected static function isInCommonPermission($currentFullRoute)
240240

241241
$commonRoutes = Route::withSubRoutes($commonRoutesDB, ArrayHelper::map(Route::find()->asArray()->all(), 'name', 'name'));
242242

243-
Yii::$app->cache->set('__commonRoutes', $commonRoutes, 3600);
243+
if ( Yii::$app->cache )
244+
Yii::$app->cache->set('__commonRoutes', $commonRoutes, 3600);
244245
}
245246

246247
return in_array($currentFullRoute, $commonRoutes);

0 commit comments

Comments
 (0)