Skip to content

Commit

Permalink
Merge pull request n8#4 from nthj/master
Browse files Browse the repository at this point in the history
Add "cache_options" key, which is forwarded to MemCached.  Used for "expires_in: 3.days" functionality
  • Loading branch information
Nathan Kontny committed Dec 13, 2012
2 parents 794456d + 3ab747a commit eb28f31
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/multi_fetch_fragments.rb
Expand Up @@ -18,6 +18,7 @@ def render_collection_with_multi_fetch_cache

if ActionController::Base.perform_caching && @options[:cache].present?

additional_cache_options = @options.fetch(:cache_options, {})
keys_to_collection_map = {}

@collection.each do |item|
Expand Down Expand Up @@ -52,7 +53,7 @@ def render_collection_with_multi_fetch_cache
results << cached_value
else
non_cached_result = non_cached_results.shift
Rails.cache.write(key, non_cached_result)
Rails.cache.write(key, non_cached_result, additional_cache_options)

results << non_cached_result
end
Expand Down

0 comments on commit eb28f31

Please sign in to comment.