Note that there are some explanatory texts on larger screens.

plurals
  1. POCache VS Session VS cookies?
    text
    copied!<p>What are the do's and don'ts about Cache VS Session VS Cookies?</p> <p>For example:<br> I'm using Session variables a lot and sometimes have problems in a booking-application when users start to order products and then go to lunch and come back some hours later and continue the booking. I store the booking in the session until the user confirms or aborts the booking so I don't need to talk to the database and handle halfway bookings in the database when users just click the X in the browser and never comes back.</p> <p>Should I instead use cache or cookies or some combination for this?</p> <p>(Also when there is some error in the app, the session-object resets itself and I get more problems because of that)</p> <p>I'm mostly doing desktop-programming and feel I lack lots of knowledge here so anyone who can expand on where to use Cache, Session, Cookies (or db) would be appreciated</p> <p><strong>Edit:</strong> From the answers it seems that a combination of DB and cookies is what I want. </p> <ol> <li>I have to store the booking in the database connected to a session-id </li> <li>Store the session-id in a cookie (encrypted). </li> <li>Every page load checking the cookie and fetch the booking from the database</li> <li>I have a clean-up procedure that runs once a week that clears unfinished bookings.</li> </ol> <p>I can't store the booking as a cookie because then the user can change prices and other sensitive data and I had to validate everything (can't trust the data).</p> <p>Have I got it right?</p> <p>And thanks for great explanations to all of you!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload