From 04d5eae4e835ead8ef785de4eb442893426f4b29 Mon Sep 17 00:00:00 2001 From: Brian Durand Date: Mon, 12 Dec 2011 13:40:29 -0600 Subject: Add ActiveSupport::Cache::NullStore to expose caching interface without actually caching for development and test environments. --- railties/guides/source/caching_with_rails.textile | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'railties/guides') diff --git a/railties/guides/source/caching_with_rails.textile b/railties/guides/source/caching_with_rails.textile index 0ef6f51190..ec9bfd4d40 100644 --- a/railties/guides/source/caching_with_rails.textile +++ b/railties/guides/source/caching_with_rails.textile @@ -332,6 +332,14 @@ caches_action :index, :expires_in => 60.seconds, :unless_exist => true For more information about Ehcache, see "http://ehcache.org/":http://ehcache.org/ . For more information about Ehcache for JRuby and Rails, see "http://ehcache.org/documentation/jruby.html":http://ehcache.org/documentation/jruby.html +h4. ActiveSupport::Cache::NullStore + +This cache store implementation is meant to be used only in development or test environments and it never stores anything. This can be very useful in development when you have code that interacts directly with +Rails.cache+, but caching may interfere with being able to see the results of code changes. With this cache store, all +fetch+ and +read+ operations will result in a miss. + + +ActionController::Base.cache_store = :null + + h4. Custom Cache Stores You can create your own custom cache store by simply extending +ActiveSupport::Cache::Store+ and implementing the appropriate methods. In this way, you can swap in any number of caching technologies into your Rails application. -- cgit v1.2.3