--- !ruby/object:RI::ClassDescription 
attributes: []

class_methods: 
- !ruby/object:RI::MethodSummary 
  name: fragment_cache_store=
comment: 
- !ruby/struct:SM::Flow::P 
  body: "Fragment caching is used for caching various blocks within templates without caching the entire action as a whole. This is useful when certain elements of an action change frequently or depend on complicated state while other parts rarely change or can be shared amongst multiple parties. The caching is doing using the cache helper available in the Action View. A template with caching might look something like:"
- !ruby/struct:SM::Flow::VERB 
  body: "  <b>Hello &lt;%= @name %&gt;</b>\n  &lt;% cache do %&gt;\n    All the topics in the system:\n    &lt;%= render_collection_of_partials &quot;topic&quot;, Topic.find_all %&gt;\n  &lt;% end %&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: "This cache will bind to the name of action that called it. So you would be able to invalidate it using <tt>expire_fragment(:controller =&gt; &quot;topics&quot;, :action =&gt; &quot;list&quot;)</tt> -- if that was the controller/action used. This is not too helpful if you need to cache multiple fragments per action or if the action itself is cached using <tt>caches_action</tt>. So instead we should qualify the name of the action used with something like:"
- !ruby/struct:SM::Flow::VERB 
  body: "  &lt;% cache(:action =&gt; &quot;list&quot;, :action_suffix =&gt; &quot;all_topics&quot;) do %&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: That would result in a name such as &quot;/topics/list/all_topics&quot;, which wouldn't conflict with any action cache and neither with another fragment using a different suffix. Note that the URL doesn't have to really exist or be callable. We're just using the url_for system to generate unique cache names that we can refer to later for expirations. The expiration call for this example would be <tt>expire_fragment(:controller =&gt; &quot;topics&quot;, :action =&gt; &quot;list&quot;, :action_suffix =&gt; &quot;all_topics&quot;)</tt>.
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Fragment stores
- !ruby/struct:SM::Flow::P 
  body: "In order to use the fragment caching, you need to designate where the caches should be stored. This is done by assigning a fragment store of which there are four different kinds:"
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "FileStore: Keeps the fragments on disk in the <tt>cache_path</tt>, which works well for all types of environments and shares the fragments for all the web server processes running off the same application directory."
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "MemoryStore: Keeps the fragments in memory, which is fine for WEBrick and for FCGI (if you don't care that each FCGI process holds its own fragment store). It's not suitable for CGI as the process is thrown away at the end of each request. It can potentially also take up a lot of memory since each process keeps all the caches in memory."
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "DRbStore: Keeps the fragments in the memory of a separate, shared DRb process. This works for all environments and only keeps one cache around for all processes, but requires that you run and manage a separate DRb process."
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "MemCacheStore: Works like DRbStore, but uses Danga's MemCache instead. Requires the ruby-memcache library: gem install ruby-memcache."
  type: :BULLET
- !ruby/struct:SM::Flow::P 
  body: "Configuration examples (MemoryStore is the default):"
- !ruby/struct:SM::Flow::VERB 
  body: "  ActionController::Base.fragment_cache_store = :memory_store\n  ActionController::Base.fragment_cache_store = :file_store, &quot;/path/to/cache/directory&quot;\n  ActionController::Base.fragment_cache_store = :drb_store, &quot;druby://localhost:9192&quot;\n  ActionController::Base.fragment_cache_store = :mem_cache_store, &quot;localhost&quot;\n  ActionController::Base.fragment_cache_store = MyOwnStore.new(&quot;parameter&quot;)\n"
constants: []

full_name: ActionController::Caching::Fragments
includes: []

instance_methods: 
- !ruby/object:RI::MethodSummary 
  name: cache_erb_fragment
- !ruby/object:RI::MethodSummary 
  name: expire_fragment
- !ruby/object:RI::MethodSummary 
  name: fragment_cache_key
- !ruby/object:RI::MethodSummary 
  name: read_fragment
- !ruby/object:RI::MethodSummary 
  name: write_fragment
name: Fragments
superclass: 
