public function run()
 {
     $cacheKey = static::className() . ':' . implode("_", [$this->model->object->id, $this->model->id, $this->viewFile, $this->limit, $this->offset, $this->thumbnailOnDemand ? '1' : '0', $this->thumbnailWidth, $this->thumbnailHeight, $this->useWatermark]);
     $result = Yii::$app->cache->get($cacheKey);
     if ($result === false) {
         if ($this->offset > 0 || !is_null($this->limit)) {
             $images = $this->model->getImages()->limit($this->limit)->offset($this->offset)->all();
         } else {
             $images = $this->model->images;
         }
         if ($this->noImageOnEmptyImages === true && count($images) === 0) {
             return $this->render('noimage', ['model' => $this->model, 'thumbnailOnDemand' => $this->thumbnailOnDemand, 'thumbnailWidth' => $this->thumbnailWidth, 'thumbnailHeight' => $this->thumbnailHeight, 'useWatermark' => $this->useWatermark, 'additional' => $this->additional]);
         }
         $result = $this->render($this->viewFile, ['model' => $this->model, 'images' => $images, 'thumbnailOnDemand' => $this->thumbnailOnDemand, 'thumbnailWidth' => $this->thumbnailWidth, 'thumbnailHeight' => $this->thumbnailHeight, 'useWatermark' => $this->useWatermark, 'additional' => $this->additional]);
         Yii::$app->cache->set($cacheKey, $result, 86400, new TagDependency(['tags' => [ActiveRecordHelper::getCommonTag(Image::className()), ActiveRecordHelper::getCommonTag($this->model->className())]]));
     }
     return $result;
 }
 public function run()
 {
     $cacheKey = "ObjectImageWidget:" . implode("_", [$this->model->object->id, $this->model->id, $this->viewFile, $this->limit, $this->offset, $this->thumbnailOnDemand ? '1' : '0', $this->thumbnailWidth, $this->thumbnailHeight, $this->useWatermark]);
     $result = Yii::$app->cache->get($cacheKey);
     if ($result === false) {
         if ($this->offset > 0 || !is_null($this->limit)) {
             $images = $this->model->getImages()->limit($this->limit)->offset($this->offset)->all();
         } else {
             $images = $this->model->images;
         }
         if ($this->noImageOnEmptyImages === true && count($images) === 0) {
             return $this->render('noimage');
         }
         $result = $this->render($this->viewFile, ['model' => $this->model, 'images' => $images, 'thumbnailOnDemand' => $this->thumbnailOnDemand, 'thumbnailWidth' => $this->thumbnailWidth, 'thumbnailHeight' => $this->thumbnailHeight, 'useWatermark' => $this->useWatermark, 'additional' => $this->additional]);
         Yii::$app->cache->set($cacheKey, $result, 86400, new \yii\caching\TagDependency(['tags' => 'Images:' . $this->model->object->id . ':' . $this->model->id]));
     }
     return $result;
 }