title: Rails 4 skip cache in Rails.cache.fetch
body: <p>My code:</p>
  
  <pre><code>def my_method(path)
      Rails.cache.fetch(path, expires_in: 10.minutes, race_condition_ttl: 10) do
          # Calls Net::HTTP.get_response URI.parse path
          response = My::api.get path
  
          if response.status == 200
              JSON.parse response.body
          else
              nil # Here I need to prevent cache
          end
      end
  end
  </code></pre>
  
  <p>I won't cache when return <code>nil</code>, but it does..
  How do I prevent caching in this case?</p>