void session_interface::save() { if(storage_.get()==NULL || !loaded_ || saved_) return; check(); new_session_ = data_copy_.empty() && !data_.empty(); if(data_.empty()) { if(get_session_cookie()!="") storage_->clear(*this); update_exposed(true); return; } time_t now = time(NULL); bool force_update=false; if(data_==data_copy_) { if(how_==fixed) { return; } if(how_==renew || how_==browser) { int64_t delta=now + timeout_val_ - timeout_in_; if(delta < timeout_val_ * 0.1) {// Less then 10% -- no renew need return; } } force_update=true; } string ar; save_data(data_,ar); temp_cookie_.clear(); storage_->save(*this,ar,session_age(),new_session_,on_server_); set_session_cookie(cookie_age(),temp_cookie_); temp_cookie_.clear(); update_exposed(force_update); saved_=true; }
void session_interface::save() { if(storage.get()==NULL || saved) return; check(); new_session = data_copy.empty() && !data.empty(); if(data.empty()) { if(get_session_cookie()!="") storage->clear(this); update_exposed(); return; } time_t now = time(NULL); if(data==data_copy) { if(how==fixed) { return; } if(how==renew || how==browser) { int64_t delta=now + timeout_val - timeout_in; if(delta < timeout_val * 0.1) {// Less then 10% -- no renew need return; } } } string ar; save_data(data,ar); temp_cookie.clear(); storage->save(this,ar,session_age(),new_session); set_session_cookie(cookie_age(),temp_cookie); temp_cookie.clear(); update_exposed(); saved=true; }