public function put($data)
{
if (empty($data) or !is_array($data)) {
return false;
}
if ($this->db->insert($data, $this->table)) {
$lastInsertId = $this->db->lastInsertId();
if ($lastInsertId == 0) {
return true;
} else {
return $lastInsertId;
}
} else {
return false;
}
}
function set($key, $value, $expire = 0) { $in['ckey'] = $key; if (is_array($value)) { $value = serialize($value); } $in['cvalue'] = $value; if ($expire == 0) { $in['expire'] = $expire; } else { $in['expire'] = time() + $expire; } $in['sid'] = $this->shard_id; $this->model->put($in); }