Esempio n. 1
0
 public function set($key, $value)
 {
     $iteration = 0;
     $cache = $this->get($key);
     if (isset($cache->order)) {
         $iteration = $cache->order;
     }
     $iteration++;
     $id = $this->db->insert(':cache', ['file_name' => $key, 'cache_data' => json_encode($value), 'time_stamp' => $iteration]);
     return $id;
 }
Esempio n. 2
0
 /**
  * 插入记录
  *
  * 返回最后插入的ID
  *
  * @param array $data 插入数据
  * @param bool $replace 是否替换插入
  * @param bool $multi 是否批量插入
  * @param bool $ignore 是否忽略重复
  * @return int
  */
 public function insert($data, $replace = false, $multi = false, $ignore = false)
 {
     $table = $this->db->table($this->tableName);
     return $this->db->insert($table, $data, $replace, $multi, $ignore);
 }