php - Session or cache for preserving data across pages? -


i'm re-writing small app phalcon in collect information user. essentially, grab firstname, lastname, email, whether or not person married, numbers pertaining person, etc across multiple pages. when user "finally" submits information (after being asked review it), write information db , perform number of calculations generate report, gets emailed out.

prior rewrite information stored in session directly, ie

 "$firstname = $this->session.get('firstname', '');".  

i'm uncomfortable approach, sessions being used user objects. generate session id, , write information database each time, , retrieve accordingly. however, don't information user, , we've noticed people tend start report process , bail out or go elsewhere. in case, don't know whether or not makes sense write db each time sake of collecting information , flushing @ end.

i guess question boils down ideal approach, seeing don't think need hit db much. practice of storing user information in session continue, or generate user objects , store them in session or cache respectively. thoughts on appreciated.

if db you'r referring mysql, i'd write db if use in-memory table.

however, if want change it, , you'll have decide what's best you, recommend moving nosql or cache solution. issue cache, if server restarts sessions destroyed.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -