Play framework handling session state

前端 未结 3 1701
孤城傲影
孤城傲影 2020-12-17 19:59

I have a Webapp that is built on top of the Play framework and Scala. It is about presenting the user with a set of questions with each question having a set of answers. Som

3条回答
  •  青春惊慌失措
    2020-12-17 20:34

    Play only supports Strings for sessions because it stores all session state in cookies - this means Play nodes can scale without the need for any sort of clustering/state sharing tech.

    If the data you want to store is small (less than 2k), then just serialise it into JSON, or it sounds like in your case, even simpler would be to serialise it into a comma separated list of answers.

    Otherwise, you can store it in a cache such as memcached or redis.

提交回复
热议问题