Index: test/fragment_cache_test.rb =================================================================== --- test/fragment_cache_test.rb (revision 2542) +++ test/fragment_cache_test.rb (working copy) @@ -97,6 +97,14 @@ ActsAsCached.config[:store].expects(:set).with(key, content, 60) @view.cache(key, { :other_options => "for the kids", :ttl => 60 }) { _erbout << content } end + + specify "should be able to skip cache gets" do + ActsAsCached.skip_cache_gets = true + ActsAsCached.config[:store].expects(:get).never + _erbout = "" + @view.cache { _erbout << "Caching is fun!" } + ActsAsCached.skip_cache_gets = false + end end context "Action caching (when used with memcached)" do Index: lib/acts_as_cached/fragment_cache.rb =================================================================== --- lib/acts_as_cached/fragment_cache.rb (revision 2542) +++ lib/acts_as_cached/fragment_cache.rb (working copy) @@ -87,7 +87,11 @@ end module Extensions - def read(*args) FragmentCacheCache.cache_store(:get, args.first) end + def read(*args) + return nil if ActsAsCached.config[:skip_gets] + FragmentCacheCache.cache_store(:get, args.first) + end + def write(name, content, options = {}) ttl = (options.is_a?(Hash) ? options[:ttl] : nil) || ActsAsCached.config[:ttl] || 25.minutes FragmentCacheCache.cache_store(:set, name, content, ttl)