Answer the question
In order to leave comments, you need to log in
Sessions in the database?
I take records from the database and randomly them.
I create an array with these, already srendomlenny data.
To "always" have this ready-made array, I write it to the session.
I'm getting a CookieOverflow error due to the 4kb limit.
I find a solution in the form of storing the ActiveRecordStore session.
And the question arises - is this the right decision to store sessions in db?
Or maybe it's better to just write the finished array in db?
Answer the question
In order to leave comments, you need to log in
store temporary data in the cache, or rather in redis, do not write anything to the session.
If the load is not large, then it is possible in the database, but there is no special sense.
Out of the box, in addition to CookieStore, MemCacheStore (requires gem dalli), CacheStore are available.
They are connected here: config/initializers/session_store.rb, an example of using CacheStore:
Rails.application.config.session_store :cache_store, key: '_super_app_session_key'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question