fix: prevent error if \Yii::$app is not set

Think this is the easiest way to prevent errors while still keeping the handy default.

If you want to completely remove Yii::$app from cache, while keeping the default, we can make this as complex as you wish. :wink: 

Maybe introducing a DefaultPrefixProvider that can be configured with strategies:

1. Try Yii::$app->id
2. Try entry script name
3. ...

Removing the default altogether would be a simpler alternative.