/** * Removes items from the specified feed and the specified conditions. * @param string $feedId * @param array $conditions The conditions that will be put in the WHERE part of the DELETE SQL. * Please refer to yii\db\ActiveRecord::where() on how to specify this parameter. * @return integer|boolean The number of items deleted, or false if the deletion is unsuccessful for some reason. * @throws \Exception in case delete failed. */ public function deleteItems($feedId, array $conditions) { $conditions = array_merge($conditions, ['feed_id' => $feedId]); if ($deletedItems = Feed::deleteAll($conditions)) { Yii::$app->cache->delete("{$this->cacheKeyPrefix}-{$feedId}"); return $deletedItems; } else { return false; } }