summaryrefslogtreecommitdiffstats
path: root/content/posts
diff options
context:
space:
mode:
Diffstat (limited to 'content/posts')
-rw-r--r--content/posts/testing-rails-cache/index.org12
1 files changed, 7 insertions, 5 deletions
diff --git a/content/posts/testing-rails-cache/index.org b/content/posts/testing-rails-cache/index.org
index 397eae4..9c98f7f 100644
--- a/content/posts/testing-rails-cache/index.org
+++ b/content/posts/testing-rails-cache/index.org
@@ -11,11 +11,13 @@ If you're in the default testing environment your rails cache is
[[https://api.rubyonrails.org/classes/ActiveSupport/Cache/NullStore.html][=ActiveSupport::Cache::NullStore=]] which will always succeed but it
doesn't actually store or return anything.
-There's an almost completely undocumented function called
-=with_local_cache= that gets implemented on =NullStore= that lets
-you run a block with a =MemoryStore= instead of a =NullStore=. This
-happens because it =prepends= the
-[[https://api.rubyonrails.org/classes/ActiveSupport/Cache/Strategy/LocalCache.html][=ActiveSupport::Cache::Strategy::LocalCache=]] class.
+There's an almost completely undocumented method called
+=with_local_cache= on =NullStore= that lets you run a block with a
+=MemoryStore= instead of a =NullStore= for the duration of the block.
+This happens because it =prepends= the
+[[https://api.rubyonrails.org/classes/ActiveSupport/Cache/Strategy/LocalCache.html][=ActiveSupport::Cache::Strategy::LocalCache=]] class. This lets you test
+one or two things that require caching without enabling it on all
+tests and slowing everything down.
#+begin_src ruby
Rails.cache.class.name