/** * 按条件查询 * @example $condition['where'] = array('expression' => 'id < :id', 'value' => array('id' => 10)); * @param array $condition * @return array */ public function getRow($condition = null) { $result = array(); $cacheKey = ''; $condition = !$condition ? array("orderby" => "id DESC", "limit" => 15) : $condition; // 如果启用缓存则通过缓存操作 if ($this->enableCache) { $cacheKey = md5($this->tableName . serialize($condition)); $result = $this->cache->get($cacheKey); if (!$result) { $result = $this->table->fetchRows($condition); $this->cache->add($cacheKey, $result, $this->cacheTime); unset($condition, $cacheKey); } } else { $result = $this->table->fetchRows($condition); } return $result; }
/** * 按条件查询 * * @example $condition['where'] = array('expression' => 'id < :id', 'value' => array('id' => 10)); * @param array $condition */ public function selectByCondition($condition) { return $this->table->fetchRows($condition); }