* [refac] check if a variable is empty before using it as an array.

This commit is contained in:
liugang
2024-11-25 08:52:41 +08:00
committed by 朱金勇
parent 8c2d499e08
commit f1fda82b0e
+1 -1
View File
@@ -432,7 +432,7 @@ class cache
/* 把被删除的数据的 id 从缓存中删除。Delete the id of the deleted data from cache. */
$setCacheKey = $this->getSetCacheKey($code);
$objectIdList = $this->cache->get($setCacheKey);
$this->cache->set($setCacheKey, array_diff($objectIdList, array_map(function($object) use ($field) { return $object->$field; }, $this->objects)));
if($objectIdList) $this->cache->set($setCacheKey, array_diff($objectIdList, array_map(function($object) use ($field) { return $object->$field; }, $this->objects)));
if(empty($this->config->cache->res[$this->table])) return;