it depends on the implementation of your cache storage. I would say that it should not cache nil values, but empty lines in caching order.
look at the implementation of the dalli repository , i.e.:
def fetch(name, options=nil) options ||= {} name = expanded_key name if block_given? unless options[:force] entry = instrument(:read, name, options) do |payload| payload[:super_operation] = :fetch if payload read_entry(name, options) end end if !entry.nil? instrument(:fetch_hit, name, options) { |payload| } entry else result = instrument(:generate, name, options) do |payload| yield end write(name, result, options) result end else read(name, options) end end
phoet source share