Flowdock
method

fetch_or_cache_partial

Importance_2
v6.0.0 - Show latest stable - 0 notes - Class: CollectionCaching
fetch_or_cache_partial(cached_partials, template, order_by:) private

`order_by` is an enumerable object containing keys of the cache, all keys are passed in whether found already or not.

`cached_partials` is a hash. If the value exists it represents the rendered partial from the cache otherwise `Hash#fetch` will take the value of its block.

This method expects a block that will return the rendered partial. An example is to render all results for each element that was not found in the cache and store it as an array. Order it so that the first empty cache element in `cached_partials` corresponds to the first element in `rendered_partials`.

If the partial is not already cached it will also be written back to the underlying cache store.

Show source
Register or log in to add new notes.