/** * 查询 * $cache_time = 0不使用缓存 */ public function select($where = array(), $attrs = array(), $cache_time = 0) { $use_cache = $cache_time > 0; $datas = array(); $cacke_key = NULL; if ($use_cache) { ksort($where); ksort($attrs); $cache_key = $this->_conditionToCacheKey($where, $attrs); $datas = $this->_cache->get($cache_key); if (!empty($datas)) { return $datas; } } $datas = parent::select($where, $attrs); if (empty($datas)) { return $datas; } $datas = Helper_Array::changeKey($datas, $this->_primary_id); if ($use_cache) { $this->_cache->set($cache_key, $datas, $cache_time); } return $datas; }