Quantcast
Channel: How to store nil with Rails.cache.fetch & memcache? - Stack Overflow
Browsing all 2 articles
Browse latest View live

Answer by Marcus for How to store nil with Rails.cache.fetch & memcache?

One solution is to use a NullObject, like this: class Specialist NullData = Struct.new(nil) def city result = Rails.cache.fetch([self.class.name, self.id, "city"], expires_in: 23.hours) do if...

View Article



How to store nil with Rails.cache.fetch & memcache?

I have an existing Model singleton method triggering expensive database queries that I want to model cache. To do this, I wrapped a Rails.cache.fetch() call around the method in question: #...

View Article
Browsing all 2 articles
Browse latest View live




Latest Images