I can't cache large ActiveRecord objects. With small ones it's ok:
sel = Car.select("id, `key`, value").limit(1000)
Rails.cache.write('miauuu', sel)
=> true
But if they get a bit larger:
sel = Car.select("id, `key`, value").limit(10000)
Rails.cache.write('miauuu', sel)
=> false
The size is not terribly high though:
ObjectSpace.memsize_of(sel)
=> 272
I'm using Dalli cache store:
Rails.application.config.cache_store
=> :dalli_store
I even ensured the max value should be large enough in production.rb has this:
config.cache_store = :dalli_store, { value_max_bytes: 2000000 }
And yet, I'm getting false here:
Rails.cache.write('miauuu', sel)
=> false
Any idea why? Thanks