public function write($id, $cargo) { extract($this->config); // if the session is set to never expire // we will set it to 1 year if ($lifetime == 0) { $lifetime = 3600 * 24 * 365; } $expire = time() + $lifetime; $data = serialize($cargo); if ($this->exists) { Query::table($table)->where('id', '=', $id)->update(array('expire' => $expire, 'data' => $data)); } else { Query::table($table)->insert(array('id' => $id, 'expire' => $expire, 'data' => $data)); } }
/** * Magic method for calling other Query methods * * @param string * @param array * @return mixed */ public static function __callStatic($method, $arguments) { $obj = Query::table(static::$prefix . static::$table)->apply(get_called_class()); if (method_exists($obj, $method)) { return call_user_func_array(array($obj, $method), $arguments); } }