Using Session to store Datatable

后端 未结 5 850
时光取名叫无心
时光取名叫无心 2021-01-13 19:04

currently we are using Sessions to store datatables in our pages so that we don\'t have to make Database hits to get the same datatable again and again. But my worry is that

5条回答
  •  -上瘾入骨i
    2021-01-13 19:12

    As a general rule of thumb I would say don't use session. I haven't had to use session for a long time. As soon as you move into a web farm situation session either gets a lot slower or a lot more complicated or both.

    Whether you will get away with it or not really depends on how much data you are storing in session, and how many users will be active within the session timeout period.

    There are a lot of caching and in memory database options available today that may be a better option. Finally, while the solution as described sounds questionable, I wouldn't optimize the existing solution until you have actually measured a problem.

提交回复
热议问题