Storing Objects in a Session in Rails

后端 未结 4 1148
一个人的身影
一个人的身影 2020-12-01 08:27

I have always been taught that storing objects in a session was a bad idea. Instead IDs should be stored that retrieve the record when needed.

However, I have an ap

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-01 09:12

    Since your app is a Rails app, I would suggest either:

    1. Using your clients' ability to cache by caching the cards in javascript. (you'd need a fairly ajaxy app to do this, see the latest RailsCast for some interesting points on javascript page caching)
    2. Use one of the many other rails-supported server-side caching options (i.e. MemCached) to cache this data.

提交回复
热议问题