added missing init() method to Cache class

This commit is contained in:
Carsten Brandt
2013-05-01 18:44:30 +02:00
parent b07b0c142f
commit c486cf410f

View File

@ -70,6 +70,18 @@ abstract class Cache extends Component implements \ArrayAccess
public $serializer;
/**
* Initializes the application component.
* This method overrides the parent implementation by setting default cache key prefix.
*/
public function init()
{
parent::init();
if ($this->keyPrefix === null) {
$this->keyPrefix = \Yii::$app->id;
}
}
/**
* Builds a normalized cache key from a given key.
*