title: How to implement memcached using a database?
body: <p>As far as I know, memcached runs in-memory and does not have a persistent backing-store.</p>
  
  <p>Currently my team is not ready yet to use memcached.</p>
  
  <p>So, I plan to write a simple database backed alternative.</p>
  
  <p>My question is pretty much in similar vein to this other question</p>
  
  <p><a href="https://stackoverflow.com/questions/33619/concurrent-logins-in-a-web-farm">Concurrent logins in a web farm</a></p>
  
  <p>My webapp has clear entry (login) and exit (logout) points.</p>
  
  <p>The plan:</p>
  
  <ol>
  <li>On login, I will add the userid into a table.</li>
  <li>On logout, I will delete the row containing the userid.</li>
  </ol>
  
  <p>Issues:</p>
  
  <p>Is there a well-used method to timeout a row in Mysql ? By method, I mean a best practice. Once a timeout has been reached, the row is removed.</p>