/**
* 重写,支持主键的缓存自动更新
* @param array $attributes
* @param string $condition
* @param array $params
* @return int
*/
public static function updateAll($attributes, $condition = '', $params = [])
{
$ret = parent::updateAll($attributes, $condition, $params);
if ($ret && self::allowFromCache($condition)) {
$cache_key = self::getCacheKey($condition[static::$pk], true);
Yii::trace('delete cache:' . $cache_key, __METHOD__);
static::getCache()->delete($cache_key);
$cache_key = self::getCacheKey($condition[static::$pk], false);
static::getCache()->delete($cache_key);
}
return $ret;
}