search

Home  >  Q&A  >  body text

php - Question about session storage in database or redis?

I would like to ask, when the session is stored in the database or redis, does it store the sessionID or the sessionID and the corresponding value?

For example: $_SESSION['name'] = 'myName';
How to save it in the mysql database. What are the fields in the database table.

Also, does redis use string type to store sessions, or does it use list to store them.

伊谢尔伦伊谢尔伦2763 days ago629

reply all(1)I'll reply

  • PHPz

    PHPz2017-06-05 11:09:54

    Database fields are generally sessionid and session serialized values, which are the same whether stored in a database or in redis. There is a PHPSESSIONID or JSPSEESSIon in the frontend through cookies. Of course, you can prevent forgery, etc. anyway. If saved, both the value and key must be saved

    reply
    0
  • Cancelreply