Two peculiarities with Rails.cache.fetch()


I’m experimenting with using this inside of models which provide
mostly static data from the database.

However, both cases where I wanted to use it, it seems to not work;
I’m not sure if it’s me, or the library:

  1. To save a boolean value. For example:

{ self.has_children? }

In the case of a ‘false’ result, this seems to always result in a
cache miss the next time. I’m guessin that the logic of fetch() is
such that it tests for success, not simply for “nil”?

  1. To save ActiveRecords. I find that upon pulling them out of the
    cache, they don’t behave as expected. IOW, some methods aren’t found.

Thanks for any input,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs